| 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 SetPanelExpansionState(Panel::ExpansionState state) OVERRIDE; |
| 68 virtual void RestorePanel() OVERRIDE; | 72 virtual bool ShouldBringUpPanelTitleBar(int mouse_x, |
| 73 int mouse_y) const OVERRIDE; |
| 69 virtual void ClosePanel() OVERRIDE; | 74 virtual void ClosePanel() OVERRIDE; |
| 70 virtual void ActivatePanel() OVERRIDE; | 75 virtual void ActivatePanel() OVERRIDE; |
| 71 virtual void DeactivatePanel() OVERRIDE; | 76 virtual void DeactivatePanel() OVERRIDE; |
| 72 virtual bool IsPanelActive() const OVERRIDE; | 77 virtual bool IsPanelActive() const OVERRIDE; |
| 73 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; | 78 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; |
| 74 virtual void UpdatePanelTitleBar() OVERRIDE; | 79 virtual void UpdatePanelTitleBar() OVERRIDE; |
| 75 virtual void ShowTaskManagerForPanel() OVERRIDE; | 80 virtual void ShowTaskManagerForPanel() OVERRIDE; |
| 76 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; | 81 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; |
| 77 virtual void FlashPanelFrame() OVERRIDE; | 82 virtual void FlashPanelFrame() OVERRIDE; |
| 78 virtual void DestroyPanelBrowser() OVERRIDE; | 83 virtual void DestroyPanelBrowser() OVERRIDE; |
| 79 | 84 |
| 80 // Overridden from AnimationDelegate: | 85 // Overridden from AnimationDelegate: |
| 81 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 86 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 82 | 87 |
| 83 PanelBrowserFrameView* GetFrameView() const; | |
| 84 bool EndDragging(bool cancelled); | 88 bool EndDragging(bool cancelled); |
| 85 void MinimizeOrRestore(); | |
| 86 | 89 |
| 87 scoped_ptr<Panel> panel_; | 90 scoped_ptr<Panel> panel_; |
| 88 gfx::Rect bounds_; | 91 gfx::Rect bounds_; |
| 89 | 92 |
| 90 // Stores the original height of the panel so we can restore it after it's | 93 // Stores the original height of the panel so we can restore it after it's |
| 91 // been minimized. | 94 // been minimized. |
| 92 int original_height_; | 95 int original_height_; |
| 93 bool minimized_; | |
| 94 | 96 |
| 95 // Is the panel being closed? Do not use it when it is closed. | 97 // Is the panel being closed? Do not use it when it is closed. |
| 96 bool closed_; | 98 bool closed_; |
| 97 | 99 |
| 98 // Is the panel receiving the focus? | 100 // Is the panel receiving the focus? |
| 99 bool focused_; | 101 bool focused_; |
| 100 | 102 |
| 101 // Is the mouse button currently down? | 103 // Is the mouse button currently down? |
| 102 bool mouse_pressed_; | 104 bool mouse_pressed_; |
| 103 | 105 |
| 104 // Location the mouse was pressed at. Used to detect drag and drop. | 106 // Location the mouse was pressed at. Used to detect drag and drop. |
| 105 gfx::Point mouse_pressed_point_; | 107 gfx::Point mouse_pressed_point_; |
| 106 | 108 |
| 107 // Is the titlebar currently being dragged? That is, has the cursor | 109 // Is the titlebar currently being dragged? That is, has the cursor |
| 108 // moved more than kDragThreshold away from its starting position? | 110 // moved more than kDragThreshold away from its starting position? |
| 109 bool mouse_dragging_; | 111 bool mouse_dragging_; |
| 110 | 112 |
| 111 // Used to animate the bounds change. | 113 // Used to animate the bounds change. |
| 112 scoped_ptr<ui::SlideAnimation> bounds_animator_; | 114 scoped_ptr<ui::SlideAnimation> bounds_animator_; |
| 113 gfx::Rect animation_start_bounds_; | 115 gfx::Rect animation_start_bounds_; |
| 114 | 116 |
| 115 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); | 117 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ | 120 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ |
| OLD | NEW |