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

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: tweaks Created 4 years, 7 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
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 INTERNAL,
41
42 // The widget was created for a client. In other words there is a client
43 // embeeded in the mus::Window.
James Cook 2016/05/27 00:02:51 nit: embedded
sky 2016/05/27 03:18:04 Done.
44 FOR_REMOTE,
James Cook 2016/05/27 00:02:52 It took me a long time to wrap my head around the
sky 2016/05/27 03:18:04 I think that would be confusing as other widgets h
James Cook 2016/05/27 16:04:03 I think I would do something like: INTERNAL and FO
sky 2016/05/27 16:58:23 Done.
45 };
46
37 explicit WmWindowMus(mus::Window* window); 47 explicit WmWindowMus(mus::Window* window);
38 // NOTE: this class is owned by the corresponding window. You shouldn't delete 48 // NOTE: this class is owned by the corresponding window. You shouldn't delete
39 // TODO(sky): friend deleter and make private. 49 // TODO(sky): friend deleter and make private.
40 ~WmWindowMus() override; 50 ~WmWindowMus() override;
41 51
42 // Returns a WmWindow for an mus::Window, creating if necessary. 52 // Returns a WmWindow for an mus::Window, creating if necessary.
43 static WmWindowMus* Get(mus::Window* window); 53 static WmWindowMus* Get(mus::Window* window);
44 54
45 static WmWindowMus* Get(views::Widget* widget); 55 static WmWindowMus* Get(views::Widget* widget);
46 56
47 static mus::Window* GetMusWindow(ash::wm::WmWindow* wm_window) { 57 static mus::Window* GetMusWindow(ash::wm::WmWindow* wm_window) {
48 return const_cast<mus::Window*>( 58 return const_cast<mus::Window*>(
49 GetMusWindow(const_cast<const ash::wm::WmWindow*>(wm_window))); 59 GetMusWindow(const_cast<const ash::wm::WmWindow*>(wm_window)));
50 } 60 }
51 static const mus::Window* GetMusWindow(const ash::wm::WmWindow* wm_window); 61 static const mus::Window* GetMusWindow(const ash::wm::WmWindow* wm_window);
52 62
53 static std::vector<WmWindow*> FromMusWindows( 63 static std::vector<WmWindow*> FromMusWindows(
54 const std::vector<mus::Window*>& mus_windows); 64 const std::vector<mus::Window*>& mus_windows);
55 65
56 // Sets the widget associated with the window. The widget is used to query 66 // 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. 67 // state, such as min/max size. The widget is not owned by the WmWindowMus.
58 void set_widget(views::Widget* widget) { widget_ = widget; } 68 void set_widget(views::Widget* widget, WidgetCreationType type) {
James Cook 2016/05/27 00:02:51 SetWidget, given that it's no longer a trivial set
sky 2016/05/27 03:18:04 It is setting two values, but I they are both ints
James Cook 2016/05/27 16:30:27 Yeah, it's fine. The style guide isn't specific ab
69 widget_ = widget;
70 widget_creation_type_ = type;
71 }
59 72
60 mus::Window* mus_window() { return window_; } 73 mus::Window* mus_window() { return window_; }
61 const mus::Window* mus_window() const { return window_; } 74 const mus::Window* mus_window() const { return window_; }
62 75
63 WmRootWindowControllerMus* GetRootWindowControllerMus() { 76 WmRootWindowControllerMus* GetRootWindowControllerMus() {
64 return const_cast<WmRootWindowControllerMus*>( 77 return const_cast<WmRootWindowControllerMus*>(
65 const_cast<const WmWindowMus*>(this)->GetRootWindowControllerMus()); 78 const_cast<const WmWindowMus*>(this)->GetRootWindowControllerMus());
66 } 79 }
67 const WmRootWindowControllerMus* GetRootWindowControllerMus() const; 80 const WmRootWindowControllerMus* GetRootWindowControllerMus() const;
68 81
69 static WmWindowMus* AsWmWindowMus(ash::wm::WmWindow* window) { 82 static WmWindowMus* AsWmWindowMus(ash::wm::WmWindow* window) {
70 return static_cast<WmWindowMus*>(window); 83 return static_cast<WmWindowMus*>(window);
71 } 84 }
72 static const WmWindowMus* AsWmWindowMus(const ash::wm::WmWindow* window) { 85 static const WmWindowMus* AsWmWindowMus(const ash::wm::WmWindow* window) {
73 return static_cast<const WmWindowMus*>(window); 86 return static_cast<const WmWindowMus*>(window);
74 } 87 }
75 88
76 ash::wm::WindowState* GetWindowState() { 89 ash::wm::WindowState* GetWindowState() {
77 return ash::wm::WmWindow::GetWindowState(); 90 return ash::wm::WmWindow::GetWindowState();
78 } 91 }
79 92
80 // WmWindow: 93 // WmWindow:
81 const ash::wm::WmWindow* GetRootWindow() const override; 94 const ash::wm::WmWindow* GetRootWindow() const override;
82 ash::wm::WmRootWindowController* GetRootWindowController() override; 95 ash::wm::WmRootWindowController* GetRootWindowController() override;
83 ash::wm::WmGlobals* GetGlobals() const override; 96 ash::wm::WmGlobals* GetGlobals() const override;
97 base::string16 GetTitle() const override;
84 void SetShellWindowId(int id) override; 98 void SetShellWindowId(int id) override;
85 int GetShellWindowId() const override; 99 int GetShellWindowId() const override;
86 ash::wm::WmWindow* GetChildByShellWindowId(int id) override; 100 ash::wm::WmWindow* GetChildByShellWindowId(int id) override;
87 ui::wm::WindowType GetType() const override; 101 ui::wm::WindowType GetType() const override;
88 ui::Layer* GetLayer() override; 102 ui::Layer* GetLayer() override;
89 display::Display GetDisplayNearestWindow() override; 103 display::Display GetDisplayNearestWindow() override;
90 bool HasNonClientArea() override; 104 bool HasNonClientArea() override;
91 int GetNonClientComponent(const gfx::Point& location) override; 105 int GetNonClientComponent(const gfx::Point& location) override;
92 gfx::Point ConvertPointToTarget(const ash::wm::WmWindow* target, 106 gfx::Point ConvertPointToTarget(const ash::wm::WmWindow* target,
93 const gfx::Point& point) const override; 107 const gfx::Point& point) const override;
94 gfx::Point ConvertPointToScreen(const gfx::Point& point) const override; 108 gfx::Point ConvertPointToScreen(const gfx::Point& point) const override;
95 gfx::Point ConvertPointFromScreen(const gfx::Point& point) const override; 109 gfx::Point ConvertPointFromScreen(const gfx::Point& point) const override;
96 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override; 110 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override;
97 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const override; 111 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const override;
98 gfx::Size GetMinimumSize() const override; 112 gfx::Size GetMinimumSize() const override;
99 gfx::Size GetMaximumSize() const override; 113 gfx::Size GetMaximumSize() const override;
100 bool GetTargetVisibility() const override; 114 bool GetTargetVisibility() const override;
101 bool IsVisible() const override; 115 bool IsVisible() const override;
116 void SetOpacity(float opacity) override;
117 float GetTargetOpacity() const override;
118 void SetTransform(const gfx::Transform& transform) override;
119 gfx::Transform GetTargetTransform() const override;
102 bool IsSystemModal() const override; 120 bool IsSystemModal() const override;
103 bool GetBoolProperty(ash::wm::WmWindowProperty key) override; 121 bool GetBoolProperty(ash::wm::WmWindowProperty key) override;
104 int GetIntProperty(ash::wm::WmWindowProperty key) override; 122 int GetIntProperty(ash::wm::WmWindowProperty key) override;
105 const ash::wm::WindowState* GetWindowState() const override; 123 const ash::wm::WindowState* GetWindowState() const override;
106 ash::wm::WmWindow* GetToplevelWindow() override; 124 ash::wm::WmWindow* GetToplevelWindow() override;
107 void SetParentUsingContext(ash::wm::WmWindow* context, 125 void SetParentUsingContext(ash::wm::WmWindow* context,
108 const gfx::Rect& screen_bounds) override; 126 const gfx::Rect& screen_bounds) override;
109 void AddChild(ash::wm::WmWindow* window) override; 127 void AddChild(ash::wm::WmWindow* window) override;
110 ash::wm::WmWindow* GetParent() override; 128 ash::wm::WmWindow* GetParent() override;
111 const ash::wm::WmWindow* GetTransientParent() const override; 129 const ash::wm::WmWindow* GetTransientParent() const override;
112 std::vector<ash::wm::WmWindow*> GetTransientChildren() override; 130 std::vector<ash::wm::WmWindow*> GetTransientChildren() override;
113 void SetLayoutManager( 131 void SetLayoutManager(
114 std::unique_ptr<ash::wm::WmLayoutManager> layout_manager) override; 132 std::unique_ptr<ash::wm::WmLayoutManager> layout_manager) override;
115 ash::wm::WmLayoutManager* GetLayoutManager() override; 133 ash::wm::WmLayoutManager* GetLayoutManager() override;
116 void SetVisibilityAnimationType(int type) override; 134 void SetVisibilityAnimationType(int type) override;
117 void SetVisibilityAnimationDuration(base::TimeDelta delta) override; 135 void SetVisibilityAnimationDuration(base::TimeDelta delta) override;
136 void SetVisibilityAnimationTransition(
137 ::wm::WindowVisibilityAnimationTransition transition) override;
118 void Animate(::wm::WindowAnimationType type) override; 138 void Animate(::wm::WindowAnimationType type) override;
139 void StopAnimatingProperty(
140 ui::LayerAnimationElement::AnimatableProperty property) override;
119 void SetBounds(const gfx::Rect& bounds) override; 141 void SetBounds(const gfx::Rect& bounds) override;
120 void SetBoundsWithTransitionDelay(const gfx::Rect& bounds, 142 void SetBoundsWithTransitionDelay(const gfx::Rect& bounds,
121 base::TimeDelta delta) override; 143 base::TimeDelta delta) override;
122 void SetBoundsDirect(const gfx::Rect& bounds) override; 144 void SetBoundsDirect(const gfx::Rect& bounds) override;
123 void SetBoundsDirectAnimated(const gfx::Rect& bounds) override; 145 void SetBoundsDirectAnimated(const gfx::Rect& bounds) override;
124 void SetBoundsDirectCrossFade(const gfx::Rect& bounds) override; 146 void SetBoundsDirectCrossFade(const gfx::Rect& bounds) override;
125 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, 147 void SetBoundsInScreen(const gfx::Rect& bounds_in_screen,
126 const display::Display& dst_display) override; 148 const display::Display& dst_display) override;
127 gfx::Rect GetBoundsInScreen() const override; 149 gfx::Rect GetBoundsInScreen() const override;
128 const gfx::Rect& GetBounds() const override; 150 const gfx::Rect& GetBounds() const override;
129 gfx::Rect GetTargetBounds() override; 151 gfx::Rect GetTargetBounds() override;
130 void ClearRestoreBounds() override; 152 void ClearRestoreBounds() override;
131 void SetRestoreBoundsInScreen(const gfx::Rect& bounds) override; 153 void SetRestoreBoundsInScreen(const gfx::Rect& bounds) override;
132 gfx::Rect GetRestoreBoundsInScreen() const override; 154 gfx::Rect GetRestoreBoundsInScreen() const override;
133 bool Contains(const ash::wm::WmWindow* other) const override; 155 bool Contains(const ash::wm::WmWindow* other) const override;
134 void SetShowState(ui::WindowShowState show_state) override; 156 void SetShowState(ui::WindowShowState show_state) override;
135 ui::WindowShowState GetShowState() const override; 157 ui::WindowShowState GetShowState() const override;
136 void SetRestoreShowState(ui::WindowShowState show_state) override; 158 void SetRestoreShowState(ui::WindowShowState show_state) override;
137 void SetLockedToRoot(bool value) override; 159 void SetLockedToRoot(bool value) override;
138 void SetCapture() override; 160 void SetCapture() override;
139 bool HasCapture() override; 161 bool HasCapture() override;
140 void ReleaseCapture() override; 162 void ReleaseCapture() override;
141 bool HasRestoreBounds() const override; 163 bool HasRestoreBounds() const override;
142 void SetAlwaysOnTop(bool value) override; 164 void SetAlwaysOnTop(bool value) override;
143 bool IsAlwaysOnTop() const override; 165 bool IsAlwaysOnTop() const override;
144 void Hide() override; 166 void Hide() override;
145 void Show() override; 167 void Show() override;
168 void Close() override;
146 bool IsFocused() const override; 169 bool IsFocused() const override;
147 bool IsActive() const override; 170 bool IsActive() const override;
148 void Activate() override; 171 void Activate() override;
149 void Deactivate() override; 172 void Deactivate() override;
150 void SetFullscreen() override; 173 void SetFullscreen() override;
151 void Maximize() override; 174 void Maximize() override;
152 void Minimize() override; 175 void Minimize() override;
153 void Unminimize() override; 176 void Unminimize() override;
154 bool CanMaximize() const override; 177 bool CanMaximize() const override;
155 bool CanMinimize() const override; 178 bool CanMinimize() const override;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 mus::Window* window_; 210 mus::Window* window_;
188 211
189 // The shell window id of this window. Shell window ids are defined in 212 // The shell window id of this window. Shell window ids are defined in
190 // ash/wm/common/wm_shell_window_ids.h. 213 // ash/wm/common/wm_shell_window_ids.h.
191 int shell_window_id_ = -1; 214 int shell_window_id_ = -1;
192 215
193 std::unique_ptr<ash::wm::WindowState> window_state_; 216 std::unique_ptr<ash::wm::WindowState> window_state_;
194 217
195 views::Widget* widget_ = nullptr; 218 views::Widget* widget_ = nullptr;
196 219
220 WidgetCreationType widget_creation_type_ = WidgetCreationType::INTERNAL;
221
197 base::ObserverList<ash::wm::WmWindowObserver> observers_; 222 base::ObserverList<ash::wm::WmWindowObserver> observers_;
198 223
199 std::unique_ptr<MusLayoutManagerAdapter> layout_manager_adapter_; 224 std::unique_ptr<MusLayoutManagerAdapter> layout_manager_adapter_;
200 225
201 std::unique_ptr<gfx::Rect> restore_bounds_in_screen_; 226 std::unique_ptr<gfx::Rect> restore_bounds_in_screen_;
202 227
203 ui::WindowShowState restore_show_state_ = ui::SHOW_STATE_DEFAULT; 228 ui::WindowShowState restore_show_state_ = ui::SHOW_STATE_DEFAULT;
204 229
205 DISALLOW_COPY_AND_ASSIGN(WmWindowMus); 230 DISALLOW_COPY_AND_ASSIGN(WmWindowMus);
206 }; 231 };
207 232
208 } // namespace wm 233 } // namespace wm
209 } // namespace mash 234 } // namespace mash
210 235
211 #endif // MASH_WM_BRIDGE_WM_WINDOW_MUS_H_ 236 #endif // MASH_WM_BRIDGE_WM_WINDOW_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698