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