Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 ASH_COMMON_WM_WINDOW_H_ | 5 #ifndef ASH_COMMON_WM_WINDOW_H_ |
| 6 #define ASH_COMMON_WM_WINDOW_H_ | 6 #define ASH_COMMON_WM_WINDOW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 virtual WmWindow* GetToplevelWindow() = 0; | 148 virtual WmWindow* GetToplevelWindow() = 0; |
| 149 // The implementation of this matches | 149 // The implementation of this matches |
| 150 // aura::client::ActivationClient::GetToplevelWindow(). | 150 // aura::client::ActivationClient::GetToplevelWindow(). |
| 151 virtual WmWindow* GetToplevelWindowForFocus() = 0; | 151 virtual WmWindow* GetToplevelWindowForFocus() = 0; |
| 152 | 152 |
| 153 // See aura::client::ParentWindowWithContext() for details of what this does. | 153 // See aura::client::ParentWindowWithContext() for details of what this does. |
| 154 virtual void SetParentUsingContext(WmWindow* context, | 154 virtual void SetParentUsingContext(WmWindow* context, |
| 155 const gfx::Rect& screen_bounds) = 0; | 155 const gfx::Rect& screen_bounds) = 0; |
| 156 virtual void AddChild(WmWindow* window) = 0; | 156 virtual void AddChild(WmWindow* window) = 0; |
| 157 | 157 |
| 158 virtual WmWindow* GetParent() = 0; | 158 WmWindow* GetParent() { |
| 159 return const_cast<WmWindow*>( | |
| 160 const_cast<const WmWindow*>(this)->GetParent()); | |
| 161 } | |
| 162 virtual const WmWindow* GetParent() const = 0; | |
| 159 | 163 |
| 160 WmWindow* GetTransientParent() { | 164 WmWindow* GetTransientParent() { |
| 161 return const_cast<WmWindow*>( | 165 return const_cast<WmWindow*>( |
| 162 const_cast<const WmWindow*>(this)->GetTransientParent()); | 166 const_cast<const WmWindow*>(this)->GetTransientParent()); |
| 163 } | 167 } |
| 164 virtual const WmWindow* GetTransientParent() const = 0; | 168 virtual const WmWindow* GetTransientParent() const = 0; |
| 165 virtual Windows GetTransientChildren() = 0; | 169 virtual Windows GetTransientChildren() = 0; |
| 166 | 170 |
| 167 virtual void SetLayoutManager( | 171 virtual void SetLayoutManager( |
| 168 std::unique_ptr<WmLayoutManager> layout_manager) = 0; | 172 std::unique_ptr<WmLayoutManager> layout_manager) = 0; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 193 virtual void SetBoundsDirectCrossFade(const gfx::Rect& bounds) = 0; | 197 virtual void SetBoundsDirectCrossFade(const gfx::Rect& bounds) = 0; |
| 194 | 198 |
| 195 // Sets the bounds in two distinct ways. The exact behavior is dictated by | 199 // Sets the bounds in two distinct ways. The exact behavior is dictated by |
| 196 // the value of BoundsInScreenBehavior set on the parent: | 200 // the value of BoundsInScreenBehavior set on the parent: |
| 197 // | 201 // |
| 198 // USE_LOCAL_COORDINATES: the bounds are applied as is to the window. In other | 202 // USE_LOCAL_COORDINATES: the bounds are applied as is to the window. In other |
| 199 // words this behaves the same as if SetBounds(bounds_in_screen) was used. | 203 // words this behaves the same as if SetBounds(bounds_in_screen) was used. |
| 200 // This is the default. | 204 // This is the default. |
| 201 // USE_SCREEN_COORDINATES: the bounds are actual screen bounds and converted | 205 // USE_SCREEN_COORDINATES: the bounds are actual screen bounds and converted |
| 202 // from the display. In this case the window may move to a different | 206 // from the display. In this case the window may move to a different |
| 203 // display if allowed (see SetDescendantsStayInSameRootWindow()). | 207 // display if allowed (see SetLockedToRoot()). |
|
James Cook
2016/09/15 16:31:40
Thanks for collapsing these two.
sky
2016/09/15 17:35:03
It was my mistake for introducing the two in the f
| |
| 204 virtual void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, | 208 virtual void SetBoundsInScreen(const gfx::Rect& bounds_in_screen, |
| 205 const display::Display& dst_display) = 0; | 209 const display::Display& dst_display) = 0; |
| 206 virtual gfx::Rect GetBoundsInScreen() const = 0; | 210 virtual gfx::Rect GetBoundsInScreen() const = 0; |
| 207 virtual const gfx::Rect& GetBounds() const = 0; | 211 virtual const gfx::Rect& GetBounds() const = 0; |
| 208 virtual gfx::Rect GetTargetBounds() = 0; | 212 virtual gfx::Rect GetTargetBounds() = 0; |
| 209 | 213 |
| 210 virtual void ClearRestoreBounds() = 0; | 214 virtual void ClearRestoreBounds() = 0; |
| 211 virtual void SetRestoreBoundsInScreen(const gfx::Rect& bounds) = 0; | 215 virtual void SetRestoreBoundsInScreen(const gfx::Rect& bounds) = 0; |
| 212 virtual gfx::Rect GetRestoreBoundsInScreen() const = 0; | 216 virtual gfx::Rect GetRestoreBoundsInScreen() const = 0; |
| 213 | 217 |
| 214 virtual bool Contains(const WmWindow* other) const = 0; | 218 virtual bool Contains(const WmWindow* other) const = 0; |
| 215 | 219 |
| 216 virtual void SetShowState(ui::WindowShowState show_state) = 0; | 220 virtual void SetShowState(ui::WindowShowState show_state) = 0; |
| 217 virtual ui::WindowShowState GetShowState() const = 0; | 221 virtual ui::WindowShowState GetShowState() const = 0; |
| 218 | 222 |
| 219 virtual void SetRestoreShowState(ui::WindowShowState show_state) = 0; | 223 virtual void SetRestoreShowState(ui::WindowShowState show_state) = 0; |
| 220 | 224 |
| 221 // Sets the restore bounds and show state overrides. These values take | 225 // Sets the restore bounds and show state overrides. These values take |
| 222 // precedence over the restore bounds and restore show state (if set). | 226 // precedence over the restore bounds and restore show state (if set). |
| 223 // If |bounds_override| is empty the values are cleared. | 227 // If |bounds_override| is empty the values are cleared. |
| 224 virtual void SetRestoreOverrides( | 228 virtual void SetRestoreOverrides( |
| 225 const gfx::Rect& bounds_override, | 229 const gfx::Rect& bounds_override, |
| 226 ui::WindowShowState window_state_override) = 0; | 230 ui::WindowShowState window_state_override) = 0; |
| 227 | 231 |
| 228 // If |value| is true the window can not be moved to another root, regardless | 232 // If |value| is true the window can not be moved to another root, regardless |
| 229 // of the bounds set on it. | 233 // of the bounds set on it. |
| 230 virtual void SetLockedToRoot(bool value) = 0; | 234 virtual void SetLockedToRoot(bool value) = 0; |
| 235 virtual bool IsLockedToRoot() const = 0; | |
| 231 | 236 |
| 232 virtual void SetCapture() = 0; | 237 virtual void SetCapture() = 0; |
| 233 virtual bool HasCapture() = 0; | 238 virtual bool HasCapture() = 0; |
| 234 virtual void ReleaseCapture() = 0; | 239 virtual void ReleaseCapture() = 0; |
| 235 | 240 |
| 236 virtual bool HasRestoreBounds() const = 0; | 241 virtual bool HasRestoreBounds() const = 0; |
| 237 | 242 |
| 238 virtual void SetAlwaysOnTop(bool value) = 0; | 243 virtual void SetAlwaysOnTop(bool value) = 0; |
| 239 virtual bool IsAlwaysOnTop() const = 0; | 244 virtual bool IsAlwaysOnTop() const = 0; |
| 240 | 245 |
| 241 virtual void Hide() = 0; | 246 virtual void Hide() = 0; |
| 242 virtual void Show() = 0; | 247 virtual void Show() = 0; |
| 243 | 248 |
| 244 // Returns the widget associated with this window, or null if not associated | 249 // Returns the widget associated with this window, or null if not associated |
| 245 // with a widget. Only ash system UI widgets are returned, not widgets created | 250 // with a widget. Only ash system UI widgets are returned, not widgets created |
| 246 // by the mus window manager code to show a non-client frame. | 251 // by the mus window manager code to show a non-client frame. |
| 247 virtual views::Widget* GetInternalWidget() = 0; | 252 virtual views::Widget* GetInternalWidget() = 0; |
| 248 | 253 |
| 249 // Requests the window to close and destroy itself. This is intended to | 254 // Requests the window to close and destroy itself. This is intended to |
| 250 // forward to an associated widget. | 255 // forward to an associated widget. |
| 251 virtual void CloseWidget() = 0; | 256 virtual void CloseWidget() = 0; |
| 252 | 257 |
| 258 virtual void SetFocused() = 0; | |
| 253 virtual bool IsFocused() const = 0; | 259 virtual bool IsFocused() const = 0; |
| 254 | 260 |
| 255 virtual bool IsActive() const = 0; | 261 virtual bool IsActive() const = 0; |
| 256 virtual void Activate() = 0; | 262 virtual void Activate() = 0; |
| 257 virtual void Deactivate() = 0; | 263 virtual void Deactivate() = 0; |
| 258 | 264 |
| 259 virtual void SetFullscreen() = 0; | 265 virtual void SetFullscreen() = 0; |
| 260 | 266 |
| 261 virtual void Maximize() = 0; | 267 virtual void Maximize() = 0; |
| 262 virtual void Minimize() = 0; | 268 virtual void Minimize() = 0; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 292 virtual void SetSnapsChildrenToPhysicalPixelBoundary() = 0; | 298 virtual void SetSnapsChildrenToPhysicalPixelBoundary() = 0; |
| 293 | 299 |
| 294 // If an ancestor has been set to snap children to pixel boundaries, then | 300 // If an ancestor has been set to snap children to pixel boundaries, then |
| 295 // snaps the layer associated with this window to the layer associated with | 301 // snaps the layer associated with this window to the layer associated with |
| 296 // the ancestor. | 302 // the ancestor. |
| 297 virtual void SnapToPixelBoundaryIfNecessary() = 0; | 303 virtual void SnapToPixelBoundaryIfNecessary() = 0; |
| 298 | 304 |
| 299 // Makes the hit region for children slightly larger for easier resizing. | 305 // Makes the hit region for children slightly larger for easier resizing. |
| 300 virtual void SetChildrenUseExtendedHitRegion() = 0; | 306 virtual void SetChildrenUseExtendedHitRegion() = 0; |
| 301 | 307 |
| 302 // Sets whether descendants of this should not be moved to a different | |
| 303 // container. This is used by SetBoundsInScreen(). | |
| 304 virtual void SetDescendantsStayInSameRootWindow(bool value) = 0; | |
| 305 | |
| 306 // Returns a View that renders the contents of this window's layers. | 308 // Returns a View that renders the contents of this window's layers. |
| 307 virtual std::unique_ptr<views::View> CreateViewWithRecreatedLayers() = 0; | 309 virtual std::unique_ptr<views::View> CreateViewWithRecreatedLayers() = 0; |
| 308 | 310 |
| 309 virtual void AddObserver(WmWindowObserver* observer) = 0; | 311 virtual void AddObserver(WmWindowObserver* observer) = 0; |
| 310 virtual void RemoveObserver(WmWindowObserver* observer) = 0; | 312 virtual void RemoveObserver(WmWindowObserver* observer) = 0; |
| 311 virtual bool HasObserver(const WmWindowObserver* observer) const = 0; | 313 virtual bool HasObserver(const WmWindowObserver* observer) const = 0; |
| 312 | 314 |
| 313 virtual void AddTransientWindowObserver( | 315 virtual void AddTransientWindowObserver( |
| 314 WmTransientWindowObserver* observer) = 0; | 316 WmTransientWindowObserver* observer) = 0; |
| 315 virtual void RemoveTransientWindowObserver( | 317 virtual void RemoveTransientWindowObserver( |
| 316 WmTransientWindowObserver* observer) = 0; | 318 WmTransientWindowObserver* observer) = 0; |
| 317 | 319 |
| 318 // Adds or removes a handler to receive events targeted at this window, before | 320 // Adds or removes a handler to receive events targeted at this window, before |
| 319 // this window handles the events itself; the handler does not recieve events | 321 // this window handles the events itself; the handler does not recieve events |
| 320 // from embedded windows. This only supports windows with internal widgets; | 322 // from embedded windows. This only supports windows with internal widgets; |
| 321 // see GetInternalWidget(). Ownership of the handler is not transferred. | 323 // see GetInternalWidget(). Ownership of the handler is not transferred. |
| 322 // | 324 // |
| 323 // Also note that the target of these events is always an aura::Window. | 325 // Also note that the target of these events is always an aura::Window. |
| 324 virtual void AddLimitedPreTargetHandler(ui::EventHandler* handler) = 0; | 326 virtual void AddLimitedPreTargetHandler(ui::EventHandler* handler) = 0; |
| 325 virtual void RemoveLimitedPreTargetHandler(ui::EventHandler* handler) = 0; | 327 virtual void RemoveLimitedPreTargetHandler(ui::EventHandler* handler) = 0; |
| 326 | 328 |
| 327 protected: | 329 protected: |
| 328 virtual ~WmWindow() {} | 330 virtual ~WmWindow() {} |
| 329 }; | 331 }; |
| 330 | 332 |
| 331 } // namespace ash | 333 } // namespace ash |
| 332 | 334 |
| 333 #endif // ASH_COMMON_WM_WINDOW_H_ | 335 #endif // ASH_COMMON_WM_WINDOW_H_ |
| OLD | NEW |