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

Side by Side Diff: chrome/browser/ui/panels/panel.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, 5 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_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/rect.h" 12 #include "ui/gfx/rect.h"
13 13
14 class NativePanel; 14 class NativePanel;
15 class PanelManager; 15 class PanelManager;
16 16
17 // A platform independent implementation of BrowserWindow for Panels. This 17 // A platform independent implementation of BrowserWindow for Panels. This
18 // class would get the first crack at all the BrowserWindow calls for Panels and 18 // class would get the first crack at all the BrowserWindow calls for Panels and
19 // do one or more of the following: 19 // do one or more of the following:
20 // - Do nothing. The function is not relevant to Panels. 20 // - Do nothing. The function is not relevant to Panels.
21 // - Throw an exceptions. The function shouldn't be called for Panels. 21 // - Throw an exceptions. The function shouldn't be called for Panels.
22 // - Do Panel specific platform independent processing and then invoke the 22 // - Do Panel specific platform independent processing and then invoke the
23 // function on the platform specific BrowserWindow member. For example, 23 // function on the platform specific BrowserWindow member. For example,
24 // Panel size is restricted to certain limits. 24 // Panel size is restricted to certain limits.
25 // - Invoke an appropriate PanelManager function to do stuff that might affect 25 // - Invoke an appropriate PanelManager function to do stuff that might affect
26 // other Panels. For example deleting a panel would rearrange other panels. 26 // other Panels. For example deleting a panel would rearrange other panels.
27 class Panel : public BrowserWindow { 27 class Panel : public BrowserWindow {
28 public: 28 public:
29 enum ExpansionState {
30 EXPANDED,
31 TITLE_ONLY,
32 MINIMIZED
33 };
34
29 virtual ~Panel(); 35 virtual ~Panel();
30 36
31 // Returns the PanelManager associated with this panel. 37 // Returns the PanelManager associated with this panel.
32 PanelManager* manager() const; 38 PanelManager* manager() const;
33 39
34 void Minimize(); 40 // Sets the expansion state to one of the following values:
35 void Restore(); 41 // * Fully expanded
jennb 2011/06/29 23:17:54 Move these to comments on the enum values.
jianli 2011/06/30 01:28:33 Done.
42 // * Shown with title-bar
43 // * Minimized to 3-pixel lines
44 void SetExpansionState(ExpansionState expansion_state);
45
46 // Should we bring up the title-bar given the current mouse point?
jennb 2011/06/29 23:17:54 Comments should explain what "bring up title-bar"
jianli 2011/06/30 01:28:33 Done.
47 bool ShouldBringUpTitleBar(int mouse_x, int mouse_y) const;
36 48
37 // BrowserWindow overrides. 49 // BrowserWindow overrides.
38 virtual void Show() OVERRIDE; 50 virtual void Show() OVERRIDE;
39 virtual void ShowInactive() OVERRIDE; 51 virtual void ShowInactive() OVERRIDE;
40 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 52 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
41 virtual void Close() OVERRIDE; 53 virtual void Close() OVERRIDE;
42 virtual void Activate() OVERRIDE; 54 virtual void Activate() OVERRIDE;
43 virtual void Deactivate() OVERRIDE; 55 virtual void Deactivate() OVERRIDE;
44 virtual bool IsActive() const OVERRIDE; 56 virtual bool IsActive() const OVERRIDE;
45 virtual void FlashFrame() OVERRIDE; 57 virtual void FlashFrame() OVERRIDE;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 const gfx::Rect& bounds); 149 const gfx::Rect& bounds);
138 150
139 // Gets the extension from the browser that a panel is created from. 151 // Gets the extension from the browser that a panel is created from.
140 // Returns NULL if it cannot be found. 152 // Returns NULL if it cannot be found.
141 static const Extension* GetExtension(Browser* browser); 153 static const Extension* GetExtension(Browser* browser);
142 154
143 #ifdef UNIT_TEST 155 #ifdef UNIT_TEST
144 NativePanel* native_panel() { return native_panel_; } 156 NativePanel* native_panel() { return native_panel_; }
145 #endif 157 #endif
146 158
159 ExpansionState expansion_state() const { return expansion_state_; }
160
147 protected: 161 protected:
148 virtual void DestroyBrowser() OVERRIDE; 162 virtual void DestroyBrowser() OVERRIDE;
149 163
150 private: 164 private:
151 friend class PanelManager; 165 friend class PanelManager;
152 166
153 // Panel can only be created using PanelManager::CreatePanel(). 167 // Panel can only be created using PanelManager::CreatePanel().
154 Panel(Browser* browser, const gfx::Rect& bounds); 168 Panel(Browser* browser, const gfx::Rect& bounds);
155 169
156 // This is different from BrowserWindow::SetBounds(): 170 // This is different from BrowserWindow::SetBounds():
157 // * SetPanelBounds() is only called by PanelManager to manage its position. 171 // * SetPanelBounds() is only called by PanelManager to manage its position.
158 // * SetBounds() is called by the API to try to change the bounds, which is 172 // * SetBounds() is called by the API to try to change the bounds, which is
159 // not allowed for Panel. 173 // not allowed for Panel.
160 void SetPanelBounds(const gfx::Rect& bounds); 174 void SetPanelBounds(const gfx::Rect& bounds);
161 175
162 // Platform specifc implementation for panels. It'd be one of 176 // Platform specifc implementation for panels. It'd be one of
163 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. 177 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa.
164 NativePanel* native_panel_; // Weak, owns us. 178 NativePanel* native_panel_; // Weak, owns us.
165 179
180 ExpansionState expansion_state_;
181
166 DISALLOW_COPY_AND_ASSIGN(Panel); 182 DISALLOW_COPY_AND_ASSIGN(Panel);
167 }; 183 };
168 184
169 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ 185 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698