| 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 CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/ui/panels/native_panel.h" | 9 #include "chrome/browser/ui/panels/native_panel.h" |
| 10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 public views::WidgetDelegateView, | 30 public views::WidgetDelegateView, |
| 31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
| 32 public ui::HWNDMessageFilter, | 32 public ui::HWNDMessageFilter, |
| 33 #endif | 33 #endif |
| 34 public gfx::AnimationDelegate { | 34 public gfx::AnimationDelegate { |
| 35 public: | 35 public: |
| 36 // The size of inside area used for mouse resizing. | 36 // The size of inside area used for mouse resizing. |
| 37 static const int kResizeInsideBoundsSize = 5; | 37 static const int kResizeInsideBoundsSize = 5; |
| 38 | 38 |
| 39 PanelView(Panel* panel, const gfx::Rect& bounds, bool always_on_top); | 39 PanelView(Panel* panel, const gfx::Rect& bounds, bool always_on_top); |
| 40 virtual ~PanelView(); | 40 ~PanelView() override; |
| 41 | 41 |
| 42 // Overridden from NativePanel: | 42 // Overridden from NativePanel: |
| 43 virtual void ShowPanel() override; | 43 void ShowPanel() override; |
| 44 virtual void ShowPanelInactive() override; | 44 void ShowPanelInactive() override; |
| 45 virtual gfx::Rect GetPanelBounds() const override; | 45 gfx::Rect GetPanelBounds() const override; |
| 46 virtual void SetPanelBounds(const gfx::Rect& bounds) override; | 46 void SetPanelBounds(const gfx::Rect& bounds) override; |
| 47 virtual void SetPanelBoundsInstantly(const gfx::Rect& bounds) override; | 47 void SetPanelBoundsInstantly(const gfx::Rect& bounds) override; |
| 48 virtual void ClosePanel() override; | 48 void ClosePanel() override; |
| 49 virtual void ActivatePanel() override; | 49 void ActivatePanel() override; |
| 50 virtual void DeactivatePanel() override; | 50 void DeactivatePanel() override; |
| 51 virtual bool IsPanelActive() const override; | 51 bool IsPanelActive() const override; |
| 52 virtual void PreventActivationByOS(bool prevent_activation) override; | 52 void PreventActivationByOS(bool prevent_activation) override; |
| 53 virtual gfx::NativeWindow GetNativePanelWindow() override; | 53 gfx::NativeWindow GetNativePanelWindow() override; |
| 54 virtual void UpdatePanelTitleBar() override; | 54 void UpdatePanelTitleBar() override; |
| 55 virtual void UpdatePanelLoadingAnimations(bool should_animate) override; | 55 void UpdatePanelLoadingAnimations(bool should_animate) override; |
| 56 virtual void PanelWebContentsFocused(content::WebContents* contents) override; | 56 void PanelWebContentsFocused(content::WebContents* contents) override; |
| 57 virtual void PanelCut() override; | 57 void PanelCut() override; |
| 58 virtual void PanelCopy() override; | 58 void PanelCopy() override; |
| 59 virtual void PanelPaste() override; | 59 void PanelPaste() override; |
| 60 virtual void DrawAttention(bool draw_attention) override; | 60 void DrawAttention(bool draw_attention) override; |
| 61 virtual bool IsDrawingAttention() const override; | 61 bool IsDrawingAttention() const override; |
| 62 virtual void HandlePanelKeyboardEvent( | 62 void HandlePanelKeyboardEvent( |
| 63 const content::NativeWebKeyboardEvent& event) override; | 63 const content::NativeWebKeyboardEvent& event) override; |
| 64 virtual void FullScreenModeChanged(bool is_full_screen) override; | 64 void FullScreenModeChanged(bool is_full_screen) override; |
| 65 virtual bool IsPanelAlwaysOnTop() const override; | 65 bool IsPanelAlwaysOnTop() const override; |
| 66 virtual void SetPanelAlwaysOnTop(bool on_top) override; | 66 void SetPanelAlwaysOnTop(bool on_top) override; |
| 67 virtual void UpdatePanelMinimizeRestoreButtonVisibility() override; | 67 void UpdatePanelMinimizeRestoreButtonVisibility() override; |
| 68 virtual void SetWindowCornerStyle(panel::CornerStyle corner_style) override; | 68 void SetWindowCornerStyle(panel::CornerStyle corner_style) override; |
| 69 virtual void PanelExpansionStateChanging( | 69 void PanelExpansionStateChanging(Panel::ExpansionState old_state, |
| 70 Panel::ExpansionState old_state, | 70 Panel::ExpansionState new_state) override; |
| 71 Panel::ExpansionState new_state) override; | 71 void AttachWebContents(content::WebContents* contents) override; |
| 72 virtual void AttachWebContents(content::WebContents* contents) override; | 72 void DetachWebContents(content::WebContents* contents) override; |
| 73 virtual void DetachWebContents(content::WebContents* contents) override; | 73 gfx::Size WindowSizeFromContentSize( |
| 74 virtual gfx::Size WindowSizeFromContentSize( | |
| 75 const gfx::Size& content_size) const override; | 74 const gfx::Size& content_size) const override; |
| 76 virtual gfx::Size ContentSizeFromWindowSize( | 75 gfx::Size ContentSizeFromWindowSize( |
| 77 const gfx::Size& window_size) const override; | 76 const gfx::Size& window_size) const override; |
| 78 virtual int TitleOnlyHeight() const override; | 77 int TitleOnlyHeight() const override; |
| 79 virtual void MinimizePanelBySystem() override; | 78 void MinimizePanelBySystem() override; |
| 80 virtual bool IsPanelMinimizedBySystem() const override; | 79 bool IsPanelMinimizedBySystem() const override; |
| 81 virtual bool IsPanelShownOnActiveDesktop() const override; | 80 bool IsPanelShownOnActiveDesktop() const override; |
| 82 virtual void ShowShadow(bool show) override; | 81 void ShowShadow(bool show) override; |
| 83 virtual NativePanelTesting* CreateNativePanelTesting() override; | 82 NativePanelTesting* CreateNativePanelTesting() override; |
| 84 | 83 |
| 85 // Overridden from views::View: | 84 // Overridden from views::View: |
| 86 virtual gfx::Size GetMinimumSize() const override; | 85 gfx::Size GetMinimumSize() const override; |
| 87 virtual gfx::Size GetMaximumSize() const override; | 86 gfx::Size GetMaximumSize() const override; |
| 88 | 87 |
| 89 // Return true if the mouse event is handled. | 88 // Return true if the mouse event is handled. |
| 90 // |mouse_location| is in screen coordinate system. | 89 // |mouse_location| is in screen coordinate system. |
| 91 bool OnTitlebarMousePressed(const gfx::Point& mouse_location); | 90 bool OnTitlebarMousePressed(const gfx::Point& mouse_location); |
| 92 bool OnTitlebarMouseDragged(const gfx::Point& mouse_location); | 91 bool OnTitlebarMouseDragged(const gfx::Point& mouse_location); |
| 93 bool OnTitlebarMouseReleased(panel::ClickModifier modifier); | 92 bool OnTitlebarMouseReleased(panel::ClickModifier modifier); |
| 94 bool OnTitlebarMouseCaptureLost(); | 93 bool OnTitlebarMouseCaptureLost(); |
| 95 | 94 |
| 96 PanelFrameView* GetFrameView() const; | 95 PanelFrameView* GetFrameView() const; |
| 97 bool IsAnimatingBounds() const; | 96 bool IsAnimatingBounds() const; |
| 98 | 97 |
| 99 Panel* panel() const { return panel_.get(); } | 98 Panel* panel() const { return panel_.get(); } |
| 100 views::Widget* window() const { return window_; } | 99 views::Widget* window() const { return window_; } |
| 101 bool force_to_paint_as_inactive() const { | 100 bool force_to_paint_as_inactive() const { |
| 102 return force_to_paint_as_inactive_; | 101 return force_to_paint_as_inactive_; |
| 103 } | 102 } |
| 104 | 103 |
| 105 // PanelStackView might want to update the stored bounds directly since it | 104 // PanelStackView might want to update the stored bounds directly since it |
| 106 // has already taken care of updating the window bounds directly. | 105 // has already taken care of updating the window bounds directly. |
| 107 void set_cached_bounds_directly(const gfx::Rect& bounds) { bounds_ = bounds; } | 106 void set_cached_bounds_directly(const gfx::Rect& bounds) { bounds_ = bounds; } |
| 108 | 107 |
| 109 private: | 108 private: |
| 110 enum MouseDraggingState { | 109 enum MouseDraggingState { |
| 111 NO_DRAGGING, | 110 NO_DRAGGING, |
| 112 DRAGGING_STARTED, | 111 DRAGGING_STARTED, |
| 113 DRAGGING_ENDED | 112 DRAGGING_ENDED |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 // Overridden from views::WidgetDelegate: | 115 // Overridden from views::WidgetDelegate: |
| 117 virtual void OnDisplayChanged() override; | 116 void OnDisplayChanged() override; |
| 118 virtual void OnWorkAreaChanged() override; | 117 void OnWorkAreaChanged() override; |
| 119 virtual bool WillProcessWorkAreaChange() const override; | 118 bool WillProcessWorkAreaChange() const override; |
| 120 virtual views::View* GetContentsView() override; | 119 views::View* GetContentsView() override; |
| 121 virtual views::NonClientFrameView* CreateNonClientFrameView( | 120 views::NonClientFrameView* CreateNonClientFrameView( |
| 122 views::Widget* widget) override; | 121 views::Widget* widget) override; |
| 123 virtual bool CanResize() const override; | 122 bool CanResize() const override; |
| 124 virtual bool CanMaximize() const override; | 123 bool CanMaximize() const override; |
| 125 virtual bool CanMinimize() const override; | 124 bool CanMinimize() const override; |
| 126 virtual views::Widget* GetWidget() override; | 125 views::Widget* GetWidget() override; |
| 127 virtual const views::Widget* GetWidget() const override; | 126 const views::Widget* GetWidget() const override; |
| 128 virtual base::string16 GetWindowTitle() const override; | 127 base::string16 GetWindowTitle() const override; |
| 129 virtual gfx::ImageSkia GetWindowAppIcon() override; | 128 gfx::ImageSkia GetWindowAppIcon() override; |
| 130 virtual gfx::ImageSkia GetWindowIcon() override; | 129 gfx::ImageSkia GetWindowIcon() override; |
| 131 virtual void WindowClosing() override; | 130 void WindowClosing() override; |
| 132 virtual void DeleteDelegate() override; | 131 void DeleteDelegate() override; |
| 133 virtual void OnWindowBeginUserBoundsChange() override; | 132 void OnWindowBeginUserBoundsChange() override; |
| 134 virtual void OnWindowEndUserBoundsChange() override; | 133 void OnWindowEndUserBoundsChange() override; |
| 135 | 134 |
| 136 // Overridden from views::View: | 135 // Overridden from views::View: |
| 137 virtual void Layout() override; | 136 void Layout() override; |
| 138 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 137 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 139 | 138 |
| 140 // Overridden from views::WidgetObserver: | 139 // Overridden from views::WidgetObserver: |
| 141 virtual void OnWidgetDestroying(views::Widget* widget) override; | 140 void OnWidgetDestroying(views::Widget* widget) override; |
| 142 virtual void OnWidgetActivationChanged(views::Widget* widget, | 141 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; |
| 143 bool active) override; | 142 void OnWidgetBoundsChanged(views::Widget* widget, |
| 144 virtual void OnWidgetBoundsChanged(views::Widget* widget, | 143 const gfx::Rect& new_bounds) override; |
| 145 const gfx::Rect& new_bounds) override; | |
| 146 | 144 |
| 147 // Overridden from ui::HWNDMessageFilter: | 145 // Overridden from ui::HWNDMessageFilter: |
| 148 #if defined(OS_WIN) | 146 #if defined(OS_WIN) |
| 149 virtual bool FilterMessage(HWND hwnd, | 147 virtual bool FilterMessage(HWND hwnd, |
| 150 UINT message, | 148 UINT message, |
| 151 WPARAM w_param, | 149 WPARAM w_param, |
| 152 LPARAM l_param, | 150 LPARAM l_param, |
| 153 LRESULT* l_result) override; | 151 LRESULT* l_result) override; |
| 154 #endif | 152 #endif |
| 155 | 153 |
| 156 // Overridden from AnimationDelegate: | 154 // Overridden from AnimationDelegate: |
| 157 virtual void AnimationEnded(const gfx::Animation* animation) override; | 155 void AnimationEnded(const gfx::Animation* animation) override; |
| 158 virtual void AnimationProgressed(const gfx::Animation* animation) override; | 156 void AnimationProgressed(const gfx::Animation* animation) override; |
| 159 | 157 |
| 160 void UpdateLoadingAnimations(bool should_animate); | 158 void UpdateLoadingAnimations(bool should_animate); |
| 161 void UpdateWindowTitle(); | 159 void UpdateWindowTitle(); |
| 162 void UpdateWindowIcon(); | 160 void UpdateWindowIcon(); |
| 163 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); | 161 void SetBoundsInternal(const gfx::Rect& bounds, bool animate); |
| 164 bool EndDragging(bool cancelled); | 162 bool EndDragging(bool cancelled); |
| 165 | 163 |
| 166 // Sets the bounds of the underlying window to |new_bounds|. Note that this | 164 // Sets the bounds of the underlying window to |new_bounds|. Note that this |
| 167 // might update the window style to work around the minimum overlapped | 165 // might update the window style to work around the minimum overlapped |
| 168 // window height limitation. | 166 // window height limitation. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 243 |
| 246 #if defined(OS_WIN) | 244 #if defined(OS_WIN) |
| 247 // Used to provide custom taskbar thumbnail for Windows 7 and later. | 245 // Used to provide custom taskbar thumbnail for Windows 7 and later. |
| 248 scoped_ptr<TaskbarWindowThumbnailerWin> thumbnailer_; | 246 scoped_ptr<TaskbarWindowThumbnailerWin> thumbnailer_; |
| 249 #endif | 247 #endif |
| 250 | 248 |
| 251 DISALLOW_COPY_AND_ASSIGN(PanelView); | 249 DISALLOW_COPY_AND_ASSIGN(PanelView); |
| 252 }; | 250 }; |
| 253 | 251 |
| 254 #endif // CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_VIEW_H_ | 252 #endif // CHROME_BROWSER_UI_VIEWS_PANELS_PANEL_VIEW_H_ |
| OLD | NEW |