Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: ash/common/wm/window_state.h

Issue 2240353002: move switch Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Virtual keyboard non-sticky mode changes. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/ash_switches.cc ('k') | ash/common/wm/window_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_COMMON_WM_WINDOW_STATE_H_ 5 #ifndef ASH_COMMON_WM_WINDOW_STATE_H_
6 #define ASH_COMMON_WM_WINDOW_STATE_H_ 6 #define ASH_COMMON_WM_WINDOW_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
11 #include "ash/common/wm/drag_details.h" 11 #include "ash/common/wm/drag_details.h"
12 #include "ash/common/wm/wm_types.h" 12 #include "ash/common/wm/wm_types.h"
13 #include "ash/common/wm_window_observer.h"
13 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/observer_list.h" 16 #include "base/observer_list.h"
16 #include "ui/base/ui_base_types.h" 17 #include "ui/base/ui_base_types.h"
17 18
18 namespace aura { 19 namespace aura {
19 class Window; 20 class Window;
20 } 21 }
21 22
22 namespace gfx { 23 namespace gfx {
(...skipping 14 matching lines...) Expand all
37 // behavior. Ash specific per-window state (such as ones that controls 38 // behavior. Ash specific per-window state (such as ones that controls
38 // window manager behavior) and ash specific window behavior (such as 39 // window manager behavior) and ash specific window behavior (such as
39 // maximize, minimize, snap sizing etc) should be added here instead 40 // maximize, minimize, snap sizing etc) should be added here instead
40 // of defining separate functions (like |MaximizeWindow(aura::Window* 41 // of defining separate functions (like |MaximizeWindow(aura::Window*
41 // window)|) or using aura Window property. 42 // window)|) or using aura Window property.
42 // The WindowState gets created when first accessed by 43 // The WindowState gets created when first accessed by
43 // |wm::GetWindowState|, and deleted when the window is deleted. 44 // |wm::GetWindowState|, and deleted when the window is deleted.
44 // Prefer using this class instead of passing aura::Window* around in 45 // Prefer using this class instead of passing aura::Window* around in
45 // ash code as this is often what you need to interact with, and 46 // ash code as this is often what you need to interact with, and
46 // accessing the window using |window()| is cheap. 47 // accessing the window using |window()| is cheap.
47 class ASH_EXPORT WindowState { 48 class ASH_EXPORT WindowState : public WmWindowObserver {
48 public: 49 public:
49 // A subclass of State class represents one of the window's states 50 // A subclass of State class represents one of the window's states
50 // that corresponds to WindowStateType in Ash environment, e.g. 51 // that corresponds to WindowStateType in Ash environment, e.g.
51 // maximized, minimized or side snapped, as subclass. 52 // maximized, minimized or side snapped, as subclass.
52 // Each subclass defines its own behavior and transition for each WMEvent. 53 // Each subclass defines its own behavior and transition for each WMEvent.
53 class State { 54 class State {
54 public: 55 public:
55 State() {} 56 State() {}
56 virtual ~State() {} 57 virtual ~State() {}
57 58
(...skipping 13 matching lines...) Expand all
71 // Gets called before the state objects gets deactivated / detached from the 72 // Gets called before the state objects gets deactivated / detached from the
72 // window, so that it can save the various states it is interested in. 73 // window, so that it can save the various states it is interested in.
73 // Note: This only gets called when the state object gets changed. 74 // Note: This only gets called when the state object gets changed.
74 virtual void DetachState(WindowState* window_state) = 0; 75 virtual void DetachState(WindowState* window_state) = 0;
75 76
76 private: 77 private:
77 DISALLOW_COPY_AND_ASSIGN(State); 78 DISALLOW_COPY_AND_ASSIGN(State);
78 }; 79 };
79 80
80 // Call GetWindowState() to instantiate this class. 81 // Call GetWindowState() to instantiate this class.
81 virtual ~WindowState(); 82 ~WindowState() override;
82 83
83 WmWindow* window() { return window_; } 84 WmWindow* window() { return window_; }
84 const WmWindow* window() const { return window_; } 85 const WmWindow* window() const { return window_; }
85 86
86 bool HasDelegate() const; 87 bool HasDelegate() const;
87 void SetDelegate(std::unique_ptr<WindowStateDelegate> delegate); 88 void SetDelegate(std::unique_ptr<WindowStateDelegate> delegate);
88 89
89 // Returns the window's current ash state type. 90 // Returns the window's current ash state type.
90 // Refer to WindowStateType definition in wm_types.h as for why Ash 91 // Refer to WindowStateType definition in wm_types.h as for why Ash
91 // has its own state type. 92 // has its own state type.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 void SetBoundsConstrained(const gfx::Rect& bounds); 360 void SetBoundsConstrained(const gfx::Rect& bounds);
360 361
361 // Sets the wndow's |bounds| and transitions to the new bounds with 362 // Sets the wndow's |bounds| and transitions to the new bounds with
362 // a scale animation. 363 // a scale animation.
363 void SetBoundsDirectAnimated(const gfx::Rect& bounds); 364 void SetBoundsDirectAnimated(const gfx::Rect& bounds);
364 365
365 // Sets the window's |bounds| and transition to the new bounds with 366 // Sets the window's |bounds| and transition to the new bounds with
366 // a cross fade animation. 367 // a cross fade animation.
367 void SetBoundsDirectCrossFade(const gfx::Rect& bounds); 368 void SetBoundsDirectCrossFade(const gfx::Rect& bounds);
368 369
370 // ash::WmWindowObserver
371 void OnWindowPropertyChanged(WmWindow* window,
372 WmWindowProperty property) override;
373
369 // The owner of this window settings. 374 // The owner of this window settings.
370 WmWindow* window_; 375 WmWindow* window_;
371 std::unique_ptr<WindowStateDelegate> delegate_; 376 std::unique_ptr<WindowStateDelegate> delegate_;
372 377
373 bool window_position_managed_; 378 bool window_position_managed_;
374 bool bounds_changed_by_user_; 379 bool bounds_changed_by_user_;
375 bool panel_attached_; 380 bool panel_attached_;
376 bool ignored_by_shelf_; 381 bool ignored_by_shelf_;
377 bool can_consume_system_keys_; 382 bool can_consume_system_keys_;
378 std::unique_ptr<DragDetails> drag_details_; 383 std::unique_ptr<DragDetails> drag_details_;
(...skipping 13 matching lines...) Expand all
392 std::unique_ptr<gfx::Rect> pre_auto_manage_window_bounds_; 397 std::unique_ptr<gfx::Rect> pre_auto_manage_window_bounds_;
393 398
394 base::ObserverList<WindowStateObserver> observer_list_; 399 base::ObserverList<WindowStateObserver> observer_list_;
395 400
396 // True to ignore a property change event to avoid reentrance in 401 // True to ignore a property change event to avoid reentrance in
397 // UpdateWindowStateType() 402 // UpdateWindowStateType()
398 bool ignore_property_change_; 403 bool ignore_property_change_;
399 404
400 std::unique_ptr<State> current_state_; 405 std::unique_ptr<State> current_state_;
401 406
407 // Restore bounds of window when moved by virtual keyboard.
408 gfx::Rect vk_restore_bounds_;
409
402 DISALLOW_COPY_AND_ASSIGN(WindowState); 410 DISALLOW_COPY_AND_ASSIGN(WindowState);
403 }; 411 };
404 412
405 } // namespace wm 413 } // namespace wm
406 } // namespace ash 414 } // namespace ash
407 415
408 #endif // ASH_COMMON_WM_WINDOW_STATE_H_ 416 #endif // ASH_COMMON_WM_WINDOW_STATE_H_
OLDNEW
« no previous file with comments | « ash/common/ash_switches.cc ('k') | ash/common/wm/window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698