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

Side by Side Diff: mash/wm/bridge/wm_window_mus.h

Issue 2012343002: Converts overview to use common ash types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 6 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 | « mash/wm/bridge/wm_root_window_controller_mus.cc ('k') | mash/wm/bridge/wm_window_mus.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 MASH_WM_BRIDGE_WM_WINDOW_MUS_H_ 5 #ifndef MASH_WM_BRIDGE_WM_WINDOW_MUS_H_
6 #define MASH_WM_BRIDGE_WM_WINDOW_MUS_H_ 6 #define MASH_WM_BRIDGE_WM_WINDOW_MUS_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/wm/common/wm_window.h" 10 #include "ash/wm/common/wm_window.h"
(...skipping 16 matching lines...) Expand all
27 27
28 class MusLayoutManagerAdapter; 28 class MusLayoutManagerAdapter;
29 class WmRootWindowControllerMus; 29 class WmRootWindowControllerMus;
30 30
31 // WmWindow implementation for mus. 31 // WmWindow implementation for mus.
32 // 32 //
33 // WmWindowMus is tied to the life of the underlying mus::Window (it is stored 33 // WmWindowMus is tied to the life of the underlying mus::Window (it is stored
34 // as an owned property). 34 // as an owned property).
35 class WmWindowMus : public ash::wm::WmWindow, public mus::WindowObserver { 35 class WmWindowMus : public ash::wm::WmWindow, public mus::WindowObserver {
36 public: 36 public:
37 // Indicates the source of the widget creation.
38 enum class WidgetCreationType {
39 // The widget was created internally, and not at the request of a client.
40 // For example, overview mode creates a number of widgets. These widgets are
41 // created with a type of INTERNAL.
42 INTERNAL,
43
44 // The widget was created for a client. In other words there is a client
45 // embedded in the mus::Window. For example, when Chrome creates a new
46 // browser window the window manager is asked to create the mus::Window.
47 // The window manager creates a mus::Window and a views::Widget to show the
48 // non-client frame decorations. In this case the creation type is
49 // FOR_CLIENT.
50
51 FOR_CLIENT,
52 };
53
37 explicit WmWindowMus(mus::Window* window); 54 explicit WmWindowMus(mus::Window* window);
38 // NOTE: this class is owned by the corresponding window. You shouldn't delete 55 // NOTE: this class is owned by the corresponding window. You shouldn't delete
39 // TODO(sky): friend deleter and make private. 56 // TODO(sky): friend deleter and make private.
40 ~WmWindowMus() override; 57 ~WmWindowMus() override;
41 58
42 // Returns a WmWindow for an mus::Window, creating if necessary. 59 // Returns a WmWindow for an mus::Window, creating if necessary.
43 static WmWindowMus* Get(mus::Window* window); 60 static WmWindowMus* Get(mus::Window* window);
44 61
45 static WmWindowMus* Get(views::Widget* widget); 62 static WmWindowMus* Get(views::Widget* widget);
46 63
47 static mus::Window* GetMusWindow(ash::wm::WmWindow* wm_window) { 64 static mus::Window* GetMusWindow(ash::wm::WmWindow* wm_window) {
48 return const_cast<mus::Window*>( 65 return const_cast<mus::Window*>(
49 GetMusWindow(const_cast<const ash::wm::WmWindow*>(wm_window))); 66 GetMusWindow(const_cast<const ash::wm::WmWindow*>(wm_window)));
50 } 67 }
51 static const mus::Window* GetMusWindow(const ash::wm::WmWindow* wm_window); 68 static const mus::Window* GetMusWindow(const ash::wm::WmWindow* wm_window);
52 69
53 static std::vector<WmWindow*> FromMusWindows( 70 static std::vector<WmWindow*> FromMusWindows(
54 const std::vector<mus::Window*>& mus_windows); 71 const std::vector<mus::Window*>& mus_windows);
55 72
56 // Sets the widget associated with the window. The widget is used to query 73 // Sets the widget associated with the window. The widget is used to query
57 // state, such as min/max size. The widget is not owned by the WmWindowMus. 74 // state, such as min/max size. The widget is not owned by the WmWindowMus.
58 void set_widget(views::Widget* widget) { widget_ = widget; } 75 void set_widget(views::Widget* widget, WidgetCreationType type) {
76 widget_ = widget;
77 widget_creation_type_ = type;
78 }
59 79
60 mus::Window* mus_window() { return window_; } 80 mus::Window* mus_window() { return window_; }
61 const mus::Window* mus_window() const { return window_; } 81 const mus::Window* mus_window() const { return window_; }
62 82
63 WmRootWindowControllerMus* GetRootWindowControllerMus() { 83 WmRootWindowControllerMus* GetRootWindowControllerMus() {
64 return const_cast<WmRootWindowControllerMus*>( 84 return const_cast<WmRootWindowControllerMus*>(
65 const_cast<const WmWindowMus*>(this)->GetRootWindowControllerMus()); 85 const_cast<const WmWindowMus*>(this)->GetRootWindowControllerMus());
66 } 86 }
67 const WmRootWindowControllerMus* GetRootWindowControllerMus() const; 87 const WmRootWindowControllerMus* GetRootWindowControllerMus() const;
68 88
69 static WmWindowMus* AsWmWindowMus(ash::wm::WmWindow* window) { 89 static WmWindowMus* AsWmWindowMus(ash::wm::WmWindow* window) {
70 return static_cast<WmWindowMus*>(window); 90 return static_cast<WmWindowMus*>(window);
71 } 91 }
72 static const WmWindowMus* AsWmWindowMus(const ash::wm::WmWindow* window) { 92 static const WmWindowMus* AsWmWindowMus(const ash::wm::WmWindow* window) {
73 return static_cast<const WmWindowMus*>(window); 93 return static_cast<const WmWindowMus*>(window);
74 } 94 }
75 95
76 ash::wm::WindowState* GetWindowState() { 96 ash::wm::WindowState* GetWindowState() {
77 return ash::wm::WmWindow::GetWindowState(); 97 return ash::wm::WmWindow::GetWindowState();
78 } 98 }
79 99
80 // WmWindow: 100 // WmWindow:
81 const ash::wm::WmWindow* GetRootWindow() const override; 101 const ash::wm::WmWindow* GetRootWindow() const override;
82 ash::wm::WmRootWindowController* GetRootWindowController() override; 102 ash::wm::WmRootWindowController* GetRootWindowController() override;
83 ash::wm::WmGlobals* GetGlobals() const override; 103 ash::wm::WmGlobals* GetGlobals() const override;
104 base::string16 GetTitle() const override;
84 void SetShellWindowId(int id) override; 105 void SetShellWindowId(int id) override;
85 int GetShellWindowId() const override; 106 int GetShellWindowId() const override;
86 ash::wm::WmWindow* GetChildByShellWindowId(int id) override; 107 ash::wm::WmWindow* GetChildByShellWindowId(int id) override;
87 ui::wm::WindowType GetType() const override; 108 ui::wm::WindowType GetType() const override;
88 ui::Layer* GetLayer() override; 109 ui::Layer* GetLayer() override;
89 display::Display GetDisplayNearestWindow() override; 110 display::Display GetDisplayNearestWindow() override;
90 bool HasNonClientArea() override; 111 bool HasNonClientArea() override;
91 int GetNonClientComponent(const gfx::Point& location) override; 112 int GetNonClientComponent(const gfx::Point& location) override;
92 gfx::Point ConvertPointToTarget(const ash::wm::WmWindow* target, 113 gfx::Point ConvertPointToTarget(const ash::wm::WmWindow* target,
93 const gfx::Point& point) const override; 114 const gfx::Point& point) const override;
94 gfx::Point ConvertPointToScreen(const gfx::Point& point) const override; 115 gfx::Point ConvertPointToScreen(const gfx::Point& point) const override;
95 gfx::Point ConvertPointFromScreen(const gfx::Point& point) const override; 116 gfx::Point ConvertPointFromScreen(const gfx::Point& point) const override;
96 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override; 117 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override;
97 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const override; 118 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const override;
98 gfx::Size GetMinimumSize() const override; 119 gfx::Size GetMinimumSize() const override;
99 gfx::Size GetMaximumSize() const override; 120 gfx::Size GetMaximumSize() const override;
100 bool GetTargetVisibility() const override; 121 bool GetTargetVisibility() const override;
101 bool IsVisible() const override; 122 bool IsVisible() const override;
123 void SetOpacity(float opacity) override;
124 float GetTargetOpacity() const override;
125 void SetTransform(const gfx::Transform& transform) override;
126 gfx::Transform GetTargetTransform() const override;
102 bool IsSystemModal() const override; 127 bool IsSystemModal() const override;
103 bool GetBoolProperty(ash::wm::WmWindowProperty key) override; 128 bool GetBoolProperty(ash::wm::WmWindowProperty key) override;
104 int GetIntProperty(ash::wm::WmWindowProperty key) override; 129 int GetIntProperty(ash::wm::WmWindowProperty key) override;
105 const ash::wm::WindowState* GetWindowState() const override; 130 const ash::wm::WindowState* GetWindowState() const override;
106 ash::wm::WmWindow* GetToplevelWindow() override; 131 ash::wm::WmWindow* GetToplevelWindow() override;
107 void SetParentUsingContext(ash::wm::WmWindow* context, 132 void SetParentUsingContext(ash::wm::WmWindow* context,
108 const gfx::Rect& screen_bounds) override; 133 const gfx::Rect& screen_bounds) override;
109 void AddChild(ash::wm::WmWindow* window) override; 134 void AddChild(ash::wm::WmWindow* window) override;
110 ash::wm::WmWindow* GetParent() override; 135 ash::wm::WmWindow* GetParent() override;
111 const ash::wm::WmWindow* GetTransientParent() const override; 136 const ash::wm::WmWindow* GetTransientParent() const override;
112 std::vector<ash::wm::WmWindow*> GetTransientChildren() override; 137 std::vector<ash::wm::WmWindow*> GetTransientChildren() override;
113 void SetLayoutManager( 138 void SetLayoutManager(
114 std::unique_ptr<ash::wm::WmLayoutManager> layout_manager) override; 139 std::unique_ptr<ash::wm::WmLayoutManager> layout_manager) override;
115 ash::wm::WmLayoutManager* GetLayoutManager() override; 140 ash::wm::WmLayoutManager* GetLayoutManager() override;
116 void SetVisibilityAnimationType(int type) override; 141 void SetVisibilityAnimationType(int type) override;
117 void SetVisibilityAnimationDuration(base::TimeDelta delta) override; 142 void SetVisibilityAnimationDuration(base::TimeDelta delta) override;
143 void SetVisibilityAnimationTransition(
144 ::wm::WindowVisibilityAnimationTransition transition) override;
118 void Animate(::wm::WindowAnimationType type) override; 145 void Animate(::wm::WindowAnimationType type) override;
146 void StopAnimatingProperty(
147 ui::LayerAnimationElement::AnimatableProperty property) override;
119 void SetBounds(const gfx::Rect& bounds) override; 148 void SetBounds(const gfx::Rect& bounds) override;
120 void SetBoundsWithTransitionDelay(const gfx::Rect& bounds, 149 void SetBoundsWithTransitionDelay(const gfx::Rect& bounds,
121 base::TimeDelta delta) override; 150 base::TimeDelta delta) override;
122 void SetBoundsDirect(const gfx::Rect& bounds) override; 151 void SetBoundsDirect(const gfx::Rect& bounds) override;
123 void SetBoundsDirectAnimated(const gfx::Rect& bounds) override; 152 void SetBoundsDirectAnimated(const gfx::Rect& bounds) override;
124 void SetBoundsDirectCrossFade(const gfx::Rect& bounds) override; 153 void SetBoundsDirectCrossFade(const gfx::Rect& bounds) override;
125 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, 154 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen,
126 const display::Display& dst_display) override; 155 const display::Display& dst_display) override;
127 gfx::Rect GetBoundsInScreen() const override; 156 gfx::Rect GetBoundsInScreen() const override;
128 const gfx::Rect& GetBounds() const override; 157 const gfx::Rect& GetBounds() const override;
129 gfx::Rect GetTargetBounds() override; 158 gfx::Rect GetTargetBounds() override;
130 void ClearRestoreBounds() override; 159 void ClearRestoreBounds() override;
131 void SetRestoreBoundsInScreen(const gfx::Rect& bounds) override; 160 void SetRestoreBoundsInScreen(const gfx::Rect& bounds) override;
132 gfx::Rect GetRestoreBoundsInScreen() const override; 161 gfx::Rect GetRestoreBoundsInScreen() const override;
133 bool Contains(const ash::wm::WmWindow* other) const override; 162 bool Contains(const ash::wm::WmWindow* other) const override;
134 void SetShowState(ui::WindowShowState show_state) override; 163 void SetShowState(ui::WindowShowState show_state) override;
135 ui::WindowShowState GetShowState() const override; 164 ui::WindowShowState GetShowState() const override;
136 void SetRestoreShowState(ui::WindowShowState show_state) override; 165 void SetRestoreShowState(ui::WindowShowState show_state) override;
137 void SetLockedToRoot(bool value) override; 166 void SetLockedToRoot(bool value) override;
138 void SetCapture() override; 167 void SetCapture() override;
139 bool HasCapture() override; 168 bool HasCapture() override;
140 void ReleaseCapture() override; 169 void ReleaseCapture() override;
141 bool HasRestoreBounds() const override; 170 bool HasRestoreBounds() const override;
142 void SetAlwaysOnTop(bool value) override; 171 void SetAlwaysOnTop(bool value) override;
143 bool IsAlwaysOnTop() const override; 172 bool IsAlwaysOnTop() const override;
144 void Hide() override; 173 void Hide() override;
145 void Show() override; 174 void Show() override;
175 void CloseWidget() override;
146 bool IsFocused() const override; 176 bool IsFocused() const override;
147 bool IsActive() const override; 177 bool IsActive() const override;
148 void Activate() override; 178 void Activate() override;
149 void Deactivate() override; 179 void Deactivate() override;
150 void SetFullscreen() override; 180 void SetFullscreen() override;
151 void Maximize() override; 181 void Maximize() override;
152 void Minimize() override; 182 void Minimize() override;
153 void Unminimize() override; 183 void Unminimize() override;
154 bool CanMaximize() const override; 184 bool CanMaximize() const override;
155 bool CanMinimize() const override; 185 bool CanMinimize() const override;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 mus::Window* window_; 217 mus::Window* window_;
188 218
189 // The shell window id of this window. Shell window ids are defined in 219 // The shell window id of this window. Shell window ids are defined in
190 // ash/wm/common/wm_shell_window_ids.h. 220 // ash/wm/common/wm_shell_window_ids.h.
191 int shell_window_id_ = -1; 221 int shell_window_id_ = -1;
192 222
193 std::unique_ptr<ash::wm::WindowState> window_state_; 223 std::unique_ptr<ash::wm::WindowState> window_state_;
194 224
195 views::Widget* widget_ = nullptr; 225 views::Widget* widget_ = nullptr;
196 226
227 WidgetCreationType widget_creation_type_ = WidgetCreationType::INTERNAL;
228
197 base::ObserverList<ash::wm::WmWindowObserver> observers_; 229 base::ObserverList<ash::wm::WmWindowObserver> observers_;
198 230
199 std::unique_ptr<MusLayoutManagerAdapter> layout_manager_adapter_; 231 std::unique_ptr<MusLayoutManagerAdapter> layout_manager_adapter_;
200 232
201 std::unique_ptr<gfx::Rect> restore_bounds_in_screen_; 233 std::unique_ptr<gfx::Rect> restore_bounds_in_screen_;
202 234
203 ui::WindowShowState restore_show_state_ = ui::SHOW_STATE_DEFAULT; 235 ui::WindowShowState restore_show_state_ = ui::SHOW_STATE_DEFAULT;
204 236
205 DISALLOW_COPY_AND_ASSIGN(WmWindowMus); 237 DISALLOW_COPY_AND_ASSIGN(WmWindowMus);
206 }; 238 };
207 239
208 } // namespace wm 240 } // namespace wm
209 } // namespace mash 241 } // namespace mash
210 242
211 #endif // MASH_WM_BRIDGE_WM_WINDOW_MUS_H_ 243 #endif // MASH_WM_BRIDGE_WM_WINDOW_MUS_H_
OLDNEW
« no previous file with comments | « mash/wm/bridge/wm_root_window_controller_mus.cc ('k') | mash/wm/bridge/wm_window_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698