| 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_NATIVE_WIDGET_AURA_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "ui/aura/client/focus_change_observer.h" | 9 #include "ui/aura/client/focus_change_observer.h" |
| 10 #include "ui/aura/window_delegate.h" | 10 #include "ui/aura/window_delegate.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 : public internal::NativeWidgetPrivate, | 56 : public internal::NativeWidgetPrivate, |
| 57 public aura::WindowDelegate, | 57 public aura::WindowDelegate, |
| 58 public aura::client::ActivationDelegate, | 58 public aura::client::ActivationDelegate, |
| 59 public aura::client::ActivationChangeObserver, | 59 public aura::client::ActivationChangeObserver, |
| 60 public aura::client::FocusChangeObserver, | 60 public aura::client::FocusChangeObserver, |
| 61 public views::internal::InputMethodDelegate, | 61 public views::internal::InputMethodDelegate, |
| 62 public aura::client::DragDropDelegate, | 62 public aura::client::DragDropDelegate, |
| 63 public aura::WindowTreeHostObserver { | 63 public aura::WindowTreeHostObserver { |
| 64 public: | 64 public: |
| 65 explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); | 65 explicit DesktopNativeWidgetAura(internal::NativeWidgetDelegate* delegate); |
| 66 virtual ~DesktopNativeWidgetAura(); | 66 ~DesktopNativeWidgetAura() override; |
| 67 | 67 |
| 68 // Maps from window to DesktopNativeWidgetAura. |window| must be a root | 68 // Maps from window to DesktopNativeWidgetAura. |window| must be a root |
| 69 // window. | 69 // window. |
| 70 static DesktopNativeWidgetAura* ForWindow(aura::Window* window); | 70 static DesktopNativeWidgetAura* ForWindow(aura::Window* window); |
| 71 | 71 |
| 72 // Called by our DesktopWindowTreeHost after it has deleted native resources; | 72 // Called by our DesktopWindowTreeHost after it has deleted native resources; |
| 73 // this is the signal that we should start our shutdown. | 73 // this is the signal that we should start our shutdown. |
| 74 virtual void OnHostClosed(); | 74 virtual void OnHostClosed(); |
| 75 | 75 |
| 76 // TODO(beng): remove this method and replace with an implementation of | 76 // TODO(beng): remove this method and replace with an implementation of |
| (...skipping 11 matching lines...) Expand all Loading... |
| 88 aura::WindowTreeHost* host() { | 88 aura::WindowTreeHost* host() { |
| 89 return host_.get(); | 89 return host_.get(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Ensures that the correct window is activated/deactivated based on whether | 92 // Ensures that the correct window is activated/deactivated based on whether |
| 93 // we are being activated/deactivated. | 93 // we are being activated/deactivated. |
| 94 void HandleActivationChanged(bool active); | 94 void HandleActivationChanged(bool active); |
| 95 | 95 |
| 96 protected: | 96 protected: |
| 97 // Overridden from internal::NativeWidgetPrivate: | 97 // Overridden from internal::NativeWidgetPrivate: |
| 98 virtual void InitNativeWidget(const Widget::InitParams& params) override; | 98 void InitNativeWidget(const Widget::InitParams& params) override; |
| 99 virtual NonClientFrameView* CreateNonClientFrameView() override; | 99 NonClientFrameView* CreateNonClientFrameView() override; |
| 100 virtual bool ShouldUseNativeFrame() const override; | 100 bool ShouldUseNativeFrame() const override; |
| 101 virtual bool ShouldWindowContentsBeTransparent() const override; | 101 bool ShouldWindowContentsBeTransparent() const override; |
| 102 virtual void FrameTypeChanged() override; | 102 void FrameTypeChanged() override; |
| 103 virtual Widget* GetWidget() override; | 103 Widget* GetWidget() override; |
| 104 virtual const Widget* GetWidget() const override; | 104 const Widget* GetWidget() const override; |
| 105 virtual gfx::NativeView GetNativeView() const override; | 105 gfx::NativeView GetNativeView() const override; |
| 106 virtual gfx::NativeWindow GetNativeWindow() const override; | 106 gfx::NativeWindow GetNativeWindow() const override; |
| 107 virtual Widget* GetTopLevelWidget() override; | 107 Widget* GetTopLevelWidget() override; |
| 108 virtual const ui::Compositor* GetCompositor() const override; | 108 const ui::Compositor* GetCompositor() const override; |
| 109 virtual ui::Compositor* GetCompositor() override; | 109 ui::Compositor* GetCompositor() override; |
| 110 virtual ui::Layer* GetLayer() override; | 110 ui::Layer* GetLayer() override; |
| 111 virtual void ReorderNativeViews() override; | 111 void ReorderNativeViews() override; |
| 112 virtual void ViewRemoved(View* view) override; | 112 void ViewRemoved(View* view) override; |
| 113 virtual void SetNativeWindowProperty(const char* name, void* value) override; | 113 void SetNativeWindowProperty(const char* name, void* value) override; |
| 114 virtual void* GetNativeWindowProperty(const char* name) const override; | 114 void* GetNativeWindowProperty(const char* name) const override; |
| 115 virtual TooltipManager* GetTooltipManager() const override; | 115 TooltipManager* GetTooltipManager() const override; |
| 116 virtual void SetCapture() override; | 116 void SetCapture() override; |
| 117 virtual void ReleaseCapture() override; | 117 void ReleaseCapture() override; |
| 118 virtual bool HasCapture() const override; | 118 bool HasCapture() const override; |
| 119 virtual InputMethod* CreateInputMethod() override; | 119 InputMethod* CreateInputMethod() override; |
| 120 virtual internal::InputMethodDelegate* GetInputMethodDelegate() override; | 120 internal::InputMethodDelegate* GetInputMethodDelegate() override; |
| 121 virtual ui::InputMethod* GetHostInputMethod() override; | 121 ui::InputMethod* GetHostInputMethod() override; |
| 122 virtual void CenterWindow(const gfx::Size& size) override; | 122 void CenterWindow(const gfx::Size& size) override; |
| 123 virtual void GetWindowPlacement( | 123 void GetWindowPlacement(gfx::Rect* bounds, |
| 124 gfx::Rect* bounds, | 124 ui::WindowShowState* maximized) const override; |
| 125 ui::WindowShowState* maximized) const override; | 125 bool SetWindowTitle(const base::string16& title) override; |
| 126 virtual bool SetWindowTitle(const base::string16& title) override; | 126 void SetWindowIcons(const gfx::ImageSkia& window_icon, |
| 127 virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, | 127 const gfx::ImageSkia& app_icon) override; |
| 128 const gfx::ImageSkia& app_icon) override; | 128 void InitModalType(ui::ModalType modal_type) override; |
| 129 virtual void InitModalType(ui::ModalType modal_type) override; | 129 gfx::Rect GetWindowBoundsInScreen() const override; |
| 130 virtual gfx::Rect GetWindowBoundsInScreen() const override; | 130 gfx::Rect GetClientAreaBoundsInScreen() const override; |
| 131 virtual gfx::Rect GetClientAreaBoundsInScreen() const override; | 131 gfx::Rect GetRestoredBounds() const override; |
| 132 virtual gfx::Rect GetRestoredBounds() const override; | 132 void SetBounds(const gfx::Rect& bounds) override; |
| 133 virtual void SetBounds(const gfx::Rect& bounds) override; | 133 void SetSize(const gfx::Size& size) override; |
| 134 virtual void SetSize(const gfx::Size& size) override; | 134 void StackAbove(gfx::NativeView native_view) override; |
| 135 virtual void StackAbove(gfx::NativeView native_view) override; | 135 void StackAtTop() override; |
| 136 virtual void StackAtTop() override; | 136 void StackBelow(gfx::NativeView native_view) override; |
| 137 virtual void StackBelow(gfx::NativeView native_view) override; | 137 void SetShape(gfx::NativeRegion shape) override; |
| 138 virtual void SetShape(gfx::NativeRegion shape) override; | 138 void Close() override; |
| 139 virtual void Close() override; | 139 void CloseNow() override; |
| 140 virtual void CloseNow() override; | 140 void Show() override; |
| 141 virtual void Show() override; | 141 void Hide() override; |
| 142 virtual void Hide() override; | 142 void ShowMaximizedWithBounds(const gfx::Rect& restored_bounds) override; |
| 143 virtual void ShowMaximizedWithBounds( | 143 void ShowWithWindowState(ui::WindowShowState state) override; |
| 144 const gfx::Rect& restored_bounds) override; | 144 bool IsVisible() const override; |
| 145 virtual void ShowWithWindowState(ui::WindowShowState state) override; | 145 void Activate() override; |
| 146 virtual bool IsVisible() const override; | 146 void Deactivate() override; |
| 147 virtual void Activate() override; | 147 bool IsActive() const override; |
| 148 virtual void Deactivate() override; | 148 void SetAlwaysOnTop(bool always_on_top) override; |
| 149 virtual bool IsActive() const override; | 149 bool IsAlwaysOnTop() const override; |
| 150 virtual void SetAlwaysOnTop(bool always_on_top) override; | 150 void SetVisibleOnAllWorkspaces(bool always_visible) override; |
| 151 virtual bool IsAlwaysOnTop() const override; | 151 void Maximize() override; |
| 152 virtual void SetVisibleOnAllWorkspaces(bool always_visible) override; | 152 void Minimize() override; |
| 153 virtual void Maximize() override; | 153 bool IsMaximized() const override; |
| 154 virtual void Minimize() override; | 154 bool IsMinimized() const override; |
| 155 virtual bool IsMaximized() const override; | 155 void Restore() override; |
| 156 virtual bool IsMinimized() const override; | 156 void SetFullscreen(bool fullscreen) override; |
| 157 virtual void Restore() override; | 157 bool IsFullscreen() const override; |
| 158 virtual void SetFullscreen(bool fullscreen) override; | 158 void SetOpacity(unsigned char opacity) override; |
| 159 virtual bool IsFullscreen() const override; | 159 void SetUseDragFrame(bool use_drag_frame) override; |
| 160 virtual void SetOpacity(unsigned char opacity) override; | 160 void FlashFrame(bool flash_frame) override; |
| 161 virtual void SetUseDragFrame(bool use_drag_frame) override; | 161 void RunShellDrag(View* view, |
| 162 virtual void FlashFrame(bool flash_frame) override; | 162 const ui::OSExchangeData& data, |
| 163 virtual void RunShellDrag(View* view, | 163 const gfx::Point& location, |
| 164 const ui::OSExchangeData& data, | 164 int operation, |
| 165 const gfx::Point& location, | 165 ui::DragDropTypes::DragEventSource source) override; |
| 166 int operation, | 166 void SchedulePaintInRect(const gfx::Rect& rect) override; |
| 167 ui::DragDropTypes::DragEventSource source) override; | 167 void SetCursor(gfx::NativeCursor cursor) override; |
| 168 virtual void SchedulePaintInRect(const gfx::Rect& rect) override; | 168 bool IsMouseEventsEnabled() const override; |
| 169 virtual void SetCursor(gfx::NativeCursor cursor) override; | 169 void ClearNativeFocus() override; |
| 170 virtual bool IsMouseEventsEnabled() const override; | 170 gfx::Rect GetWorkAreaBoundsInScreen() const override; |
| 171 virtual void ClearNativeFocus() override; | 171 Widget::MoveLoopResult RunMoveLoop( |
| 172 virtual gfx::Rect GetWorkAreaBoundsInScreen() const override; | |
| 173 virtual Widget::MoveLoopResult RunMoveLoop( | |
| 174 const gfx::Vector2d& drag_offset, | 172 const gfx::Vector2d& drag_offset, |
| 175 Widget::MoveLoopSource source, | 173 Widget::MoveLoopSource source, |
| 176 Widget::MoveLoopEscapeBehavior escape_behavior) override; | 174 Widget::MoveLoopEscapeBehavior escape_behavior) override; |
| 177 virtual void EndMoveLoop() override; | 175 void EndMoveLoop() override; |
| 178 virtual void SetVisibilityChangedAnimationsEnabled(bool value) override; | 176 void SetVisibilityChangedAnimationsEnabled(bool value) override; |
| 179 virtual ui::NativeTheme* GetNativeTheme() const override; | 177 ui::NativeTheme* GetNativeTheme() const override; |
| 180 virtual void OnRootViewLayout() override; | 178 void OnRootViewLayout() override; |
| 181 virtual bool IsTranslucentWindowOpacitySupported() const override; | 179 bool IsTranslucentWindowOpacitySupported() const override; |
| 182 virtual void OnSizeConstraintsChanged() override; | 180 void OnSizeConstraintsChanged() override; |
| 183 virtual void RepostNativeEvent(gfx::NativeEvent native_event) override; | 181 void RepostNativeEvent(gfx::NativeEvent native_event) override; |
| 184 | 182 |
| 185 // Overridden from aura::WindowDelegate: | 183 // Overridden from aura::WindowDelegate: |
| 186 virtual gfx::Size GetMinimumSize() const override; | 184 gfx::Size GetMinimumSize() const override; |
| 187 virtual gfx::Size GetMaximumSize() const override; | 185 gfx::Size GetMaximumSize() const override; |
| 188 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 186 void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 189 const gfx::Rect& new_bounds) override {} | 187 const gfx::Rect& new_bounds) override {} |
| 190 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override; | 188 gfx::NativeCursor GetCursor(const gfx::Point& point) override; |
| 191 virtual int GetNonClientComponent(const gfx::Point& point) const override; | 189 int GetNonClientComponent(const gfx::Point& point) const override; |
| 192 virtual bool ShouldDescendIntoChildForEventHandling( | 190 bool ShouldDescendIntoChildForEventHandling( |
| 193 aura::Window* child, | 191 aura::Window* child, |
| 194 const gfx::Point& location) override; | 192 const gfx::Point& location) override; |
| 195 virtual bool CanFocus() override; | 193 bool CanFocus() override; |
| 196 virtual void OnCaptureLost() override; | 194 void OnCaptureLost() override; |
| 197 virtual void OnPaint(gfx::Canvas* canvas) override; | 195 void OnPaint(gfx::Canvas* canvas) override; |
| 198 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 196 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 199 virtual void OnWindowDestroying(aura::Window* window) override; | 197 void OnWindowDestroying(aura::Window* window) override; |
| 200 virtual void OnWindowDestroyed(aura::Window* window) override; | 198 void OnWindowDestroyed(aura::Window* window) override; |
| 201 virtual void OnWindowTargetVisibilityChanged(bool visible) override; | 199 void OnWindowTargetVisibilityChanged(bool visible) override; |
| 202 virtual bool HasHitTestMask() const override; | 200 bool HasHitTestMask() const override; |
| 203 virtual void GetHitTestMask(gfx::Path* mask) const override; | 201 void GetHitTestMask(gfx::Path* mask) const override; |
| 204 | 202 |
| 205 // Overridden from ui::EventHandler: | 203 // Overridden from ui::EventHandler: |
| 206 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 204 void OnKeyEvent(ui::KeyEvent* event) override; |
| 207 virtual void OnMouseEvent(ui::MouseEvent* event) override; | 205 void OnMouseEvent(ui::MouseEvent* event) override; |
| 208 virtual void OnScrollEvent(ui::ScrollEvent* event) override; | 206 void OnScrollEvent(ui::ScrollEvent* event) override; |
| 209 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 207 void OnGestureEvent(ui::GestureEvent* event) override; |
| 210 | 208 |
| 211 // Overridden from aura::client::ActivationDelegate: | 209 // Overridden from aura::client::ActivationDelegate: |
| 212 virtual bool ShouldActivate() const override; | 210 bool ShouldActivate() const override; |
| 213 | 211 |
| 214 // Overridden from aura::client::ActivationChangeObserver: | 212 // Overridden from aura::client::ActivationChangeObserver: |
| 215 virtual void OnWindowActivated(aura::Window* gained_active, | 213 void OnWindowActivated(aura::Window* gained_active, |
| 216 aura::Window* lost_active) override; | 214 aura::Window* lost_active) override; |
| 217 | 215 |
| 218 // Overridden from aura::client::FocusChangeObserver: | 216 // Overridden from aura::client::FocusChangeObserver: |
| 219 virtual void OnWindowFocused(aura::Window* gained_focus, | 217 void OnWindowFocused(aura::Window* gained_focus, |
| 220 aura::Window* lost_focus) override; | 218 aura::Window* lost_focus) override; |
| 221 | 219 |
| 222 // Overridden from views::internal::InputMethodDelegate: | 220 // Overridden from views::internal::InputMethodDelegate: |
| 223 virtual void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; | 221 void DispatchKeyEventPostIME(const ui::KeyEvent& key) override; |
| 224 | 222 |
| 225 // Overridden from aura::client::DragDropDelegate: | 223 // Overridden from aura::client::DragDropDelegate: |
| 226 virtual void OnDragEntered(const ui::DropTargetEvent& event) override; | 224 void OnDragEntered(const ui::DropTargetEvent& event) override; |
| 227 virtual int OnDragUpdated(const ui::DropTargetEvent& event) override; | 225 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
| 228 virtual void OnDragExited() override; | 226 void OnDragExited() override; |
| 229 virtual int OnPerformDrop(const ui::DropTargetEvent& event) override; | 227 int OnPerformDrop(const ui::DropTargetEvent& event) override; |
| 230 | 228 |
| 231 // Overridden from aura::WindowTreeHostObserver: | 229 // Overridden from aura::WindowTreeHostObserver: |
| 232 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) override; | 230 void OnHostCloseRequested(const aura::WindowTreeHost* host) override; |
| 233 virtual void OnHostResized(const aura::WindowTreeHost* host) override; | 231 void OnHostResized(const aura::WindowTreeHost* host) override; |
| 234 virtual void OnHostMoved(const aura::WindowTreeHost* host, | 232 void OnHostMoved(const aura::WindowTreeHost* host, |
| 235 const gfx::Point& new_origin) override; | 233 const gfx::Point& new_origin) override; |
| 236 | 234 |
| 237 private: | 235 private: |
| 238 friend class FocusManagerEventHandler; | 236 friend class FocusManagerEventHandler; |
| 239 friend class RootWindowDestructionObserver; | 237 friend class RootWindowDestructionObserver; |
| 240 | 238 |
| 241 // Installs the input method filter. | 239 // Installs the input method filter. |
| 242 void InstallInputMethodEventFilter(); | 240 void InstallInputMethodEventFilter(); |
| 243 | 241 |
| 244 // To save a clear on platforms where the window is never transparent, the | 242 // To save a clear on platforms where the window is never transparent, the |
| 245 // window is only set as transparent when the glass frame is in use. | 243 // window is only set as transparent when the glass frame is in use. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // The following factory is used for calls to close the NativeWidgetAura | 312 // The following factory is used for calls to close the NativeWidgetAura |
| 315 // instance. | 313 // instance. |
| 316 base::WeakPtrFactory<DesktopNativeWidgetAura> close_widget_factory_; | 314 base::WeakPtrFactory<DesktopNativeWidgetAura> close_widget_factory_; |
| 317 | 315 |
| 318 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura); | 316 DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAura); |
| 319 }; | 317 }; |
| 320 | 318 |
| 321 } // namespace views | 319 } // namespace views |
| 322 | 320 |
| 323 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ | 321 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_NATIVE_WIDGET_AURA_H_ |
| OLD | NEW |