1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60

ash / wm / test / fake_window_state.cc [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/wm/test/fake_window_state.h"

#include "ash/wm/wm_event.h"
#include "ui/aura/window.h"

namespace ash {

FakeWindowState::FakeWindowState(chromeos::WindowStateType initial_state_type)
    : state_type_(initial_state_type) {}

FakeWindowState::~FakeWindowState() = default;

void FakeWindowState::OnWMEvent(WindowState* window_state,
                                const WMEvent* event) {
  switch (event->type()) {
    case WM_EVENT_MINIMIZE:
      was_visible_on_minimize_ = window_state->window()->IsVisible();
      break;
    case WM_EVENT_SET_BOUNDS:
      last_requested_bounds_ =
          event->AsSetBoundsWMEvent()->requested_bounds_in_parent();
      break;
    default:
      break;
  }
}

chromeos::WindowStateType FakeWindowState::GetType() const {
  return state_type_;
}

FakeWindowStateDelegate::FakeWindowStateDelegate() = default;

FakeWindowStateDelegate::~FakeWindowStateDelegate() = default;

bool FakeWindowStateDelegate::ToggleFullscreen(WindowState* window_state) {
  return false;
}

void FakeWindowStateDelegate::ToggleLockedFullscreen(
    WindowState* window_state) {
  ++toggle_locked_fullscreen_count_;
}

void FakeWindowStateDelegate::OnDragStarted(int component) {
  drag_in_progress_ = true;
  drag_start_component_ = component;
}

void FakeWindowStateDelegate::OnDragFinished(bool cancel,
                                             const gfx::PointF& location) {
  drag_in_progress_ = false;
  drag_end_location_ = location;
}

}  // namespace ash