Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/ui/panels/panel_browser_view.h

Issue 7242017: Support minimizing the panel into 3-pixel line on Windows. Also support bringing up/down the titl... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/ui/panels/native_panel.h" 11 #include "chrome/browser/ui/panels/native_panel.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 12 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "ui/base/animation/animation_delegate.h" 13 #include "ui/base/animation/animation_delegate.h"
14 14
15 class Browser; 15 class Browser;
16 class Panel; 16 class Panel;
17 class PanelBrowserFrameView; 17 class PanelBrowserFrameView;
18 namespace ui { 18 namespace ui {
19 class SlideAnimation; 19 class SlideAnimation;
20 } 20 }
21 21
22 // A browser view that implements Panel specific behavior. 22 // A browser view that implements Panel specific behavior.
23 class PanelBrowserView : public BrowserView, 23 class PanelBrowserView : public BrowserView,
24 public NativePanel, 24 public NativePanel,
25 public ui::AnimationDelegate { 25 public ui::AnimationDelegate {
26 public: 26 public:
27 enum ExpandState {
jennb 2011/06/27 23:18:02 This ExpandState seems like something all platform
jianli 2011/06/29 01:28:12 Moved to Panel.
28 FULLY_RESTORED,
29 TITLEBAR_RESTORED,
30 FULLY_MINIMIZED
31 };
32
27 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds); 33 PanelBrowserView(Browser* browser, Panel* panel, const gfx::Rect& bounds);
28 virtual ~PanelBrowserView(); 34 virtual ~PanelBrowserView();
29 35
30 Panel* panel() const { return panel_.get(); } 36 Panel* panel() const { return panel_.get(); }
31 bool closed() const { return closed_; } 37 bool closed() const { return closed_; }
32 bool focused() const { return focused_; } 38 bool focused() const { return focused_; }
39 ExpandState expand_state() const { return expand_state_; }
40
41 PanelBrowserFrameView* GetFrameView() const;
33 42
34 // Called from frame view when title bar receives a mouse event. 43 // Called from frame view when title bar receives a mouse event.
35 // Return true if the event is handled. 44 // Return true if the event is handled.
36 bool OnTitleBarMousePressed(const views::MouseEvent& event); 45 bool OnTitleBarMousePressed(const views::MouseEvent& event);
37 bool OnTitleBarMouseDragged(const views::MouseEvent& event); 46 bool OnTitleBarMouseDragged(const views::MouseEvent& event);
38 bool OnTitleBarMouseReleased(const views::MouseEvent& event); 47 bool OnTitleBarMouseReleased(const views::MouseEvent& event);
39 bool OnTitleBarMouseCaptureLost(); 48 bool OnTitleBarMouseCaptureLost();
40 49
41 private: 50 private:
42 friend class PanelBrowserViewTest; 51 friend class PanelBrowserViewTest;
(...skipping 14 matching lines...) Expand all
57 // Overridden from views::WidgetDelegate: 66 // Overridden from views::WidgetDelegate:
58 virtual void OnDisplayChanged() OVERRIDE; 67 virtual void OnDisplayChanged() OVERRIDE;
59 virtual void OnWorkAreaChanged() OVERRIDE; 68 virtual void OnWorkAreaChanged() OVERRIDE;
60 virtual bool WillProcessWorkAreaChange() const OVERRIDE; 69 virtual bool WillProcessWorkAreaChange() const OVERRIDE;
61 70
62 // Overridden from NativePanel: 71 // Overridden from NativePanel:
63 virtual void ShowPanel() OVERRIDE; 72 virtual void ShowPanel() OVERRIDE;
64 virtual gfx::Rect GetPanelBounds() const OVERRIDE; 73 virtual gfx::Rect GetPanelBounds() const OVERRIDE;
65 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; 74 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE;
66 virtual void MinimizePanel() OVERRIDE; 75 virtual void MinimizePanel() OVERRIDE;
67 virtual void RestorePanel() OVERRIDE; 76 virtual void RestorePanel(bool titlebar_only) OVERRIDE;
68 virtual void ClosePanel() OVERRIDE; 77 virtual void ClosePanel() OVERRIDE;
69 virtual void ActivatePanel() OVERRIDE; 78 virtual void ActivatePanel() OVERRIDE;
70 virtual void DeactivatePanel() OVERRIDE; 79 virtual void DeactivatePanel() OVERRIDE;
71 virtual bool IsPanelActive() const OVERRIDE; 80 virtual bool IsPanelActive() const OVERRIDE;
72 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; 81 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE;
73 virtual void UpdatePanelTitleBar() OVERRIDE; 82 virtual void UpdatePanelTitleBar() OVERRIDE;
74 virtual void ShowTaskManagerForPanel() OVERRIDE; 83 virtual void ShowTaskManagerForPanel() OVERRIDE;
75 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; 84 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE;
76 virtual void FlashPanelFrame() OVERRIDE; 85 virtual void FlashPanelFrame() OVERRIDE;
77 virtual void DestroyPanelBrowser() OVERRIDE; 86 virtual void DestroyPanelBrowser() OVERRIDE;
78 87
79 // Overridden from AnimationDelegate: 88 // Overridden from AnimationDelegate:
80 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 89 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
81 90
82 PanelBrowserFrameView* GetFrameView() const;
83 bool EndDragging(bool cancelled); 91 bool EndDragging(bool cancelled);
84 void MinimizeOrRestore(); 92 void MinimizeOrRestore();
93 void AdjustHeight(int height);
85 94
86 scoped_ptr<Panel> panel_; 95 scoped_ptr<Panel> panel_;
87 gfx::Rect bounds_; 96 gfx::Rect bounds_;
88 97
89 // Stores the original height of the panel so we can restore it after it's 98 // Stores the original height of the panel so we can restore it after it's
90 // been minimized. 99 // been minimized.
91 int original_height_; 100 int original_height_;
92 bool minimized_; 101
102 // Is the panel restored, minimized, or partially restored with titlebar?
103 ExpandState expand_state_;
93 104
94 // Is the panel being closed? Do not use it when it is closed. 105 // Is the panel being closed? Do not use it when it is closed.
95 bool closed_; 106 bool closed_;
96 107
97 // Is the panel receiving the focus? 108 // Is the panel receiving the focus?
98 bool focused_; 109 bool focused_;
99 110
100 // Is the mouse button currently down? 111 // Is the mouse button currently down?
101 bool mouse_pressed_; 112 bool mouse_pressed_;
102 113
103 // Location the mouse was pressed at. Used to detect drag and drop. 114 // Location the mouse was pressed at. Used to detect drag and drop.
104 gfx::Point mouse_pressed_point_; 115 gfx::Point mouse_pressed_point_;
105 116
106 // Is the titlebar currently being dragged? That is, has the cursor 117 // Is the titlebar currently being dragged? That is, has the cursor
107 // moved more than kDragThreshold away from its starting position? 118 // moved more than kDragThreshold away from its starting position?
108 bool mouse_dragging_; 119 bool mouse_dragging_;
109 120
110 // Used to animate the bounds change. 121 // Used to animate the bounds change.
111 scoped_ptr<ui::SlideAnimation> bounds_animator_; 122 scoped_ptr<ui::SlideAnimation> bounds_animator_;
112 gfx::Rect animation_start_bounds_; 123 gfx::Rect animation_start_bounds_;
113 124
114 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView); 125 DISALLOW_COPY_AND_ASSIGN(PanelBrowserView);
115 }; 126 };
116 127
117 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_ 128 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698