| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_WIN_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_WIN_H_ |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_WIN_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_WIN_H_ |
| 7 | 7 |
| 8 #include "ui/aura/client/animation_host.h" |
| 8 #include "ui/aura/root_window_host.h" | 9 #include "ui/aura/root_window_host.h" |
| 9 #include "ui/views/views_export.h" | 10 #include "ui/views/views_export.h" |
| 10 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" | 11 #include "ui/views/widget/desktop_aura/desktop_root_window_host.h" |
| 11 #include "ui/views/win/hwnd_message_handler_delegate.h" | 12 #include "ui/views/win/hwnd_message_handler_delegate.h" |
| 12 | 13 |
| 13 namespace aura { | 14 namespace aura { |
| 14 namespace client { | 15 namespace client { |
| 15 class FocusClient; | 16 class FocusClient; |
| 16 class ScreenPositionClient; | 17 class ScreenPositionClient; |
| 17 } | 18 } |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace views { | 21 namespace views { |
| 21 class DesktopActivationClient; | 22 class DesktopActivationClient; |
| 22 class DesktopCaptureClient; | 23 class DesktopCaptureClient; |
| 23 class DesktopCursorClient; | 24 class DesktopCursorClient; |
| 24 class DesktopDispatcherClient; | 25 class DesktopDispatcherClient; |
| 25 class DesktopDragDropClientWin; | 26 class DesktopDragDropClientWin; |
| 26 class HWNDMessageHandler; | 27 class HWNDMessageHandler; |
| 27 | 28 |
| 28 namespace corewm { | 29 namespace corewm { |
| 29 class CursorManager; | 30 class CursorManager; |
| 30 } | 31 } |
| 31 | 32 |
| 32 class VIEWS_EXPORT DesktopRootWindowHostWin | 33 class VIEWS_EXPORT DesktopRootWindowHostWin |
| 33 : public DesktopRootWindowHost, | 34 : public DesktopRootWindowHost, |
| 35 public aura::client::AnimationHost, |
| 34 public aura::RootWindowHost, | 36 public aura::RootWindowHost, |
| 35 public HWNDMessageHandlerDelegate { | 37 public HWNDMessageHandlerDelegate { |
| 36 public: | 38 public: |
| 37 DesktopRootWindowHostWin( | 39 DesktopRootWindowHostWin( |
| 38 internal::NativeWidgetDelegate* native_widget_delegate, | 40 internal::NativeWidgetDelegate* native_widget_delegate, |
| 39 DesktopNativeWidgetAura* desktop_native_widget_aura, | 41 DesktopNativeWidgetAura* desktop_native_widget_aura, |
| 40 const gfx::Rect& initial_bounds); | 42 const gfx::Rect& initial_bounds); |
| 41 virtual ~DesktopRootWindowHostWin(); | 43 virtual ~DesktopRootWindowHostWin(); |
| 42 | 44 |
| 43 // A way of converting an HWND into a content window. | 45 // A way of converting an HWND into a content window. |
| 44 static aura::Window* GetContentWindowForHWND(HWND hwnd); | 46 static aura::Window* GetContentWindowForHWND(HWND hwnd); |
| 45 | 47 |
| 46 protected: | 48 protected: |
| 47 // Overridden from DesktopRootWindowHost: | 49 // Overridden from DesktopRootWindowHost: |
| 48 virtual aura::RootWindow* Init(aura::Window* content_window, | 50 virtual aura::RootWindow* Init(aura::Window* content_window, |
| 49 const Widget::InitParams& params) OVERRIDE; | 51 const Widget::InitParams& params) OVERRIDE; |
| 52 virtual void InitFocus(aura::Window* window) OVERRIDE; |
| 50 virtual void Close() OVERRIDE; | 53 virtual void Close() OVERRIDE; |
| 51 virtual void CloseNow() OVERRIDE; | 54 virtual void CloseNow() OVERRIDE; |
| 52 virtual aura::RootWindowHost* AsRootWindowHost() OVERRIDE; | 55 virtual aura::RootWindowHost* AsRootWindowHost() OVERRIDE; |
| 53 virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; | 56 virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; |
| 54 virtual void ShowMaximizedWithBounds( | 57 virtual void ShowMaximizedWithBounds( |
| 55 const gfx::Rect& restored_bounds) OVERRIDE; | 58 const gfx::Rect& restored_bounds) OVERRIDE; |
| 56 virtual bool IsVisible() const OVERRIDE; | 59 virtual bool IsVisible() const OVERRIDE; |
| 57 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 60 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 58 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; | 61 virtual void CenterWindow(const gfx::Size& size) OVERRIDE; |
| 59 virtual void GetWindowPlacement( | 62 virtual void GetWindowPlacement( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 virtual bool CopyAreaToSkCanvas(const gfx::Rect& source_bounds, | 121 virtual bool CopyAreaToSkCanvas(const gfx::Rect& source_bounds, |
| 119 const gfx::Point& dest_offset, | 122 const gfx::Point& dest_offset, |
| 120 SkCanvas* canvas) OVERRIDE; | 123 SkCanvas* canvas) OVERRIDE; |
| 121 virtual bool GrabSnapshot( | 124 virtual bool GrabSnapshot( |
| 122 const gfx::Rect& snapshot_bounds, | 125 const gfx::Rect& snapshot_bounds, |
| 123 std::vector<unsigned char>* png_representation) OVERRIDE; | 126 std::vector<unsigned char>* png_representation) OVERRIDE; |
| 124 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; | 127 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; |
| 125 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 128 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
| 126 virtual void PrepareForShutdown() OVERRIDE; | 129 virtual void PrepareForShutdown() OVERRIDE; |
| 127 | 130 |
| 131 // Overridden from aura::client::AnimationHost |
| 132 virtual void SetHostTransitionBounds(const gfx::Rect& bounds) OVERRIDE; |
| 133 virtual void OnWindowHidingAnimationCompleted() OVERRIDE; |
| 134 |
| 128 // Overridden from HWNDMessageHandlerDelegate: | 135 // Overridden from HWNDMessageHandlerDelegate: |
| 129 virtual bool IsWidgetWindow() const OVERRIDE; | 136 virtual bool IsWidgetWindow() const OVERRIDE; |
| 130 virtual bool IsUsingCustomFrame() const OVERRIDE; | 137 virtual bool IsUsingCustomFrame() const OVERRIDE; |
| 131 virtual void SchedulePaint() OVERRIDE; | 138 virtual void SchedulePaint() OVERRIDE; |
| 132 virtual void EnableInactiveRendering() OVERRIDE; | 139 virtual void EnableInactiveRendering() OVERRIDE; |
| 133 virtual bool IsInactiveRenderingDisabled() OVERRIDE; | 140 virtual bool IsInactiveRenderingDisabled() OVERRIDE; |
| 134 virtual bool CanResize() const OVERRIDE; | 141 virtual bool CanResize() const OVERRIDE; |
| 135 virtual bool CanMaximize() const OVERRIDE; | 142 virtual bool CanMaximize() const OVERRIDE; |
| 136 virtual bool CanActivate() const OVERRIDE; | 143 virtual bool CanActivate() const OVERRIDE; |
| 137 virtual bool WidgetSizeIsClientSize() const OVERRIDE; | 144 virtual bool WidgetSizeIsClientSize() const OVERRIDE; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 234 |
| 228 // In some cases, we set a screen position client on |root_window_|. If we | 235 // In some cases, we set a screen position client on |root_window_|. If we |
| 229 // do, we're responsible for the lifetime. | 236 // do, we're responsible for the lifetime. |
| 230 scoped_ptr<aura::client::ScreenPositionClient> position_client_; | 237 scoped_ptr<aura::client::ScreenPositionClient> position_client_; |
| 231 | 238 |
| 232 // Controls visibility of the cursor. | 239 // Controls visibility of the cursor. |
| 233 scoped_ptr<views::corewm::CursorManager> cursor_client_; | 240 scoped_ptr<views::corewm::CursorManager> cursor_client_; |
| 234 | 241 |
| 235 scoped_ptr<DesktopDragDropClientWin> drag_drop_client_; | 242 scoped_ptr<DesktopDragDropClientWin> drag_drop_client_; |
| 236 | 243 |
| 244 // Extra size added to the host window. Typically, the window size matches |
| 245 // the contained content, however, when performing a translating or scaling |
| 246 // animation the window has to be enlarged so that the content is not |
| 247 // clipped. |
| 248 gfx::Rect window_expansion_; |
| 249 |
| 250 // Whether the window close should be converted to a hide, and then actually |
| 251 // closed on the completion of the hide animation. This is cached because |
| 252 // the property is set on the contained window which has a shorter lifetime. |
| 253 bool should_animate_window_close_; |
| 254 |
| 255 // When Close()d and animations are being applied to this window, the close |
| 256 // of the window needs to be deferred to when the close animation is |
| 257 // completed. This variable indicates that a Close was converted to a Hide, |
| 258 // so that when the Hide is completed the host window should be closed. |
| 259 bool pending_close_; |
| 260 |
| 237 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostWin); | 261 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostWin); |
| 238 }; | 262 }; |
| 239 | 263 |
| 240 } // namespace views | 264 } // namespace views |
| 241 | 265 |
| 242 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_WIN_H_ | 266 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_ROOT_WINDOW_HOST_WIN_H_ |
| OLD | NEW |