| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PANELS_PANEL_BROWSER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 public NativePanel, | 24 public NativePanel, |
| 25 public ui::AnimationDelegate { | 25 public ui::AnimationDelegate { |
| 26 public: | 26 public: |
| 27 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); | 27 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); |
| 28 virtual ~PanelBrowserView(); | 28 virtual ~PanelBrowserView(); |
| 29 | 29 |
| 30 Panel* panel() const { return panel_.get(); } | 30 Panel* panel() const { return panel_.get(); } |
| 31 bool closed() const { return closed_; } | 31 bool closed() const { return closed_; } |
| 32 bool focused() const { return focused_; } | 32 bool focused() const { return focused_; } |
| 33 | 33 |
| 34 PanelBrowserFrameView* GetFrameView() const; |
| 35 |
| 34 // Called from frame view when title bar receives a mouse event. | 36 // Called from frame view when title bar receives a mouse event. |
| 35 // Return true if the event is handled. | 37 // Return true if the event is handled. |
| 36 bool OnTitleBarMousePressed(const views::MouseEvent& event); | 38 bool OnTitleBarMousePressed(const views::MouseEvent& event); |
| 37 bool OnTitleBarMouseDragged(const views::MouseEvent& event); | 39 bool OnTitleBarMouseDragged(const views::MouseEvent& event); |
| 38 bool OnTitleBarMouseReleased(const views::MouseEvent& event); | 40 bool OnTitleBarMouseReleased(const views::MouseEvent& event); |
| 39 bool OnTitleBarMouseCaptureLost(); | 41 bool OnTitleBarMouseCaptureLost(); |
| 40 | 42 |
| 41 private: | 43 private: |
| 42 friend class PanelBrowserViewTest; | 44 friend class PanelBrowserViewTest; |
| 43 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, CreatePanel); | 45 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, CreatePanel); |
| 44 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, ShowOrHideSettingsButton); | 46 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, ShowOrHideSettingsButton); |
| 45 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, SetBoundsAnimation); | 47 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, SetBoundsAnimation); |
| 46 | 48 |
| 47 // Overridden from BrowserView: | 49 // Overridden from BrowserView: |
| 48 virtual void Init() OVERRIDE; | 50 virtual void Init() OVERRIDE; |
| 49 virtual void Close() OVERRIDE; | 51 virtual void Close() OVERRIDE; |
| 52 virtual bool CanResize() const OVERRIDE { return false; } |
| 53 virtual bool CanMaximize() const OVERRIDE { return false; } |
| 50 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | 54 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; |
| 51 virtual void UpdateTitleBar() OVERRIDE; | 55 virtual void UpdateTitleBar() OVERRIDE; |
| 52 virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const OVERRIDE; | 56 virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const OVERRIDE; |
| 53 virtual void OnWindowActivationChanged(bool active) OVERRIDE; | 57 virtual void OnWindowActivationChanged(bool active) OVERRIDE; |
| 54 virtual bool AcceleratorPressed(const views::Accelerator& accelerator) | 58 virtual bool AcceleratorPressed(const views::Accelerator& accelerator) |
| 55 OVERRIDE; | 59 OVERRIDE; |
| 56 | 60 |
| 57 // Overridden from views::WidgetDelegate: | 61 // Overridden from views::WidgetDelegate: |
| 58 virtual void OnDisplayChanged() OVERRIDE; | 62 virtual void OnDisplayChanged() OVERRIDE; |
| 59 virtual void OnWorkAreaChanged() OVERRIDE; | 63 virtual void OnWorkAreaChanged() OVERRIDE; |
| 60 virtual bool WillProcessWorkAreaChange() const OVERRIDE; | 64 virtual bool WillProcessWorkAreaChange() const OVERRIDE; |
| 61 | 65 |
| 62 // Overridden from NativePanel: | 66 // Overridden from NativePanel: |
| 63 virtual void ShowPanel() OVERRIDE; | 67 virtual void ShowPanel() OVERRIDE; |
| 64 virtual void ShowPanelInactive() OVERRIDE; | 68 virtual void ShowPanelInactive() OVERRIDE; |
| 65 virtual gfx::Rect GetPanelBounds() const OVERRIDE; | 69 virtual gfx::Rect GetPanelBounds() const OVERRIDE; |
| 66 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; | 70 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; |
| 67 virtual void MinimizePanel() OVERRIDE; | 71 virtual void OnPanelExpansionStateChanged( |
| 68 virtual void RestorePanel() OVERRIDE; | 72 Panel::ExpansionState expansion_state) OVERRIDE; |
| 73 virtual bool ShouldBringUpPanelTitleBar(int mouse_x, |
| 74 int mouse_y) const OVERRIDE; |
| 69 virtual void ClosePanel() OVERRIDE; | 75 virtual void ClosePanel() OVERRIDE; |
| 70 virtual void ActivatePanel() OVERRIDE; | 76 virtual void ActivatePanel() OVERRIDE; |
| 71 virtual void DeactivatePanel() OVERRIDE; | 77 virtual void DeactivatePanel() OVERRIDE; |
| 72 virtual bool IsPanelActive() const OVERRIDE; | 78 virtual bool IsPanelActive() const OVERRIDE; |
| 73 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; | 79 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; |
| 74 virtual void UpdatePanelTitleBar() OVERRIDE; | 80 virtual void UpdatePanelTitleBar() OVERRIDE; |
| 75 virtual void ShowTaskManagerForPanel() OVERRIDE; | 81 virtual void ShowTaskManagerForPanel() OVERRIDE; |
| 76 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; | 82 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; |
| 77 virtual void FlashPanelFrame() OVERRIDE; | 83 virtual void FlashPanelFrame() OVERRIDE; |
| 78 virtual void DestroyPanelBrowser() OVERRIDE; | 84 virtual void DestroyPanelBrowser() OVERRIDE; |
| 79 | 85 |
| 80 // Overridden from AnimationDelegate: | 86 // Overridden from AnimationDelegate: |
| 81 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 87 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 82 | 88 |
| 83 PanelBrowserFrameView* GetFrameView() const; | |
| 84 bool EndDragging(bool cancelled); | 89 bool EndDragging(bool cancelled); |
| 85 void MinimizeOrRestore(); | |
| 86 | 90 |
| 87 scoped_ptr<Panel> panel_; | 91 scoped_ptr<Panel> panel_; |
| 88 gfx::Rect bounds_; | 92 gfx::Rect bounds_; |
| 89 | 93 |
| 90 // Stores the original height of the panel so we can restore it after it's | 94 // Stores the original height of the panel so we can restore it after it's |
| 91 // been minimized. | 95 // been minimized. |
| 92 int original_height_; | 96 int original_height_; |
| 93 bool minimized_; | |
| 94 | 97 |
| 95 // Is the panel being closed? Do not use it when it is closed. | 98 // Is the panel being closed? Do not use it when it is closed. |
| 96 bool closed_; | 99 bool closed_; |
| 97 | 100 |
| 98 // Is the panel receiving the focus? | 101 // Is the panel receiving the focus? |
| 99 bool focused_; | 102 bool focused_; |
| 100 | 103 |
| 101 // Is the mouse button currently down? | 104 // Is the mouse button currently down? |
| 102 bool mouse_pressed_; | 105 bool mouse_pressed_; |
| 103 | 106 |
| 104 // Location the mouse was pressed at. Used to detect drag and drop. | 107 // Location the mouse was pressed at. Used to detect drag and drop. |
| 105 gfx::Point mouse_pressed_point_; | 108 gfx::Point mouse_pressed_point_; |
| 106 | 109 |
| 107 // Is the titlebar currently being dragged? That is, has the cursor | 110 // Is the titlebar currently being dragged? That is, has the cursor |
| 108 // moved more than kDragThreshold away from its starting position? | 111 // moved more than kDragThreshold away from its starting position? |
| 109 bool mouse_dragging_; | 112 bool mouse_dragging_; |
| 110 | 113 |
| 111 // Used to animate the bounds change. | 114 // Used to animate the bounds change. |
| 112 scoped_ptr<ui::SlideAnimation> bounds_animator_; | 115 scoped_ptr<ui::SlideAnimation> bounds_animator_; |
| 113 gfx::Rect animation_start_bounds_; | 116 gfx::Rect animation_start_bounds_; |
| 114 | 117 |
| 115 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); | 118 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); |
| 116 }; | 119 }; |
| 117 | 120 |
| 118 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ | 121 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
| OLD | NEW |