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_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 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 // - Throw an exceptions. The function shouldn't be called for Panels. | 25 // - Throw an exceptions. The function shouldn't be called for Panels. |
26 // - Do Panel specific platform independent processing and then invoke the | 26 // - Do Panel specific platform independent processing and then invoke the |
27 // function on the platform specific BrowserWindow member. For example, | 27 // function on the platform specific BrowserWindow member. For example, |
28 // Panel size is restricted to certain limits. | 28 // Panel size is restricted to certain limits. |
29 // - Invoke an appropriate PanelManager function to do stuff that might affect | 29 // - Invoke an appropriate PanelManager function to do stuff that might affect |
30 // other Panels. For example deleting a panel would rearrange other panels. | 30 // other Panels. For example deleting a panel would rearrange other panels. |
31 class Panel : public BrowserWindow, | 31 class Panel : public BrowserWindow, |
32 public TabStripModelObserver, | 32 public TabStripModelObserver, |
33 public content::NotificationObserver { | 33 public content::NotificationObserver { |
34 public: | 34 public: |
35 enum StripOwner { | |
jennb
2012/01/19 18:14:26
PanelLayout? More informative than StripOwner.
jianli
2012/01/19 22:24:41
Renamed to LayoutState, per discussion.
| |
36 // The panel is docked to the bottom of the screen. The user might only be | |
jennb
2012/01/19 18:14:26
For this comment and the next, I would drop the se
jianli
2012/01/19 22:24:41
Done.
| |
37 // able to resize the panel. | |
38 DOCKED, | |
39 // The panel can appear anywhere on the screen. The user can resize or | |
40 // reposition the panel at will. | |
41 DETACHED, | |
42 // The panel is put into the overflow area due to no space available in the | |
jennb
2012/01/19 18:14:26
s/no space available/insufficient space
jianli
2012/01/19 22:24:41
Done.
| |
43 // normal display area. | |
jennb
2012/01/19 18:14:26
s/normal/docked
"normal" is vague and open to int
jianli
2012/01/19 22:24:41
Done.
| |
44 IN_OVERFLOW | |
45 }; | |
46 | |
35 enum ExpansionState { | 47 enum ExpansionState { |
36 // The panel is fully expanded with both title-bar and the client-area. | 48 // The panel is fully expanded with both title-bar and the client-area. |
37 EXPANDED, | 49 EXPANDED, |
38 // The panel is shown with the title-bar only. | 50 // The panel is shown with the title-bar only. |
39 TITLE_ONLY, | 51 TITLE_ONLY, |
40 // The panel is shown with 3-pixel line. | 52 // The panel is shown with 3-pixel line. |
41 MINIMIZED, | 53 MINIMIZED |
42 // The panel is put into the overflow area due to no space available in the | |
43 // normal display area. | |
44 IN_OVERFLOW | |
45 }; | 54 }; |
46 | 55 |
47 // The panel can be minimized to 4-pixel lines. | 56 // The panel can be minimized to 4-pixel lines. |
48 static const int kMinimizedPanelHeight = 4; | 57 static const int kMinimizedPanelHeight = 4; |
49 | 58 |
50 virtual ~Panel(); | 59 virtual ~Panel(); |
51 | 60 |
52 // Returns the PanelManager associated with this panel. | 61 // Returns the PanelManager associated with this panel. |
53 PanelManager* manager() const; | 62 PanelManager* manager() const; |
54 | 63 |
55 // Gets the extension that a panel is created from. | 64 // Gets the extension that a panel is created from. |
56 // Returns NULL if it cannot be found. | 65 // Returns NULL if it cannot be found. |
57 const Extension* GetExtension() const; | 66 const Extension* GetExtension() const; |
58 | 67 |
68 void SetStripOwner(StripOwner new_strip_owner); | |
59 void SetExpansionState(ExpansionState new_expansion_state); | 69 void SetExpansionState(ExpansionState new_expansion_state); |
60 | 70 |
61 bool IsDrawingAttention() const; | 71 bool IsDrawingAttention() const; |
62 | 72 |
63 // This function will only get called by PanelManager when full screen mode | 73 // This function will only get called by PanelManager when full screen mode |
64 // changes i.e it gets called when an app goes into full screen mode or when | 74 // changes i.e it gets called when an app goes into full screen mode or when |
65 // an app exits full screen mode. Panel should respond by making sure | 75 // an app exits full screen mode. Panel should respond by making sure |
66 // a) it does not go on top when some app enters full screen mode. | 76 // a) it does not go on top when some app enters full screen mode. |
67 // b) it remains on top when an app exits full screen mode. | 77 // b) it remains on top when an app exits full screen mode. |
68 void FullScreenModeChanged(bool is_full_screen); | 78 void FullScreenModeChanged(bool is_full_screen); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 | 221 |
212 // Used on platforms where the panel cannot determine its window size | 222 // Used on platforms where the panel cannot determine its window size |
213 // until the window has been created. (e.g. GTK) | 223 // until the window has been created. (e.g. GTK) |
214 void OnWindowSizeAvailable(); | 224 void OnWindowSizeAvailable(); |
215 | 225 |
216 // Asynchronous completion of panel close request. | 226 // Asynchronous completion of panel close request. |
217 void OnNativePanelClosed(); | 227 void OnNativePanelClosed(); |
218 | 228 |
219 NativePanel* native_panel() { return native_panel_; } | 229 NativePanel* native_panel() { return native_panel_; } |
220 Browser* browser() const { return browser_; } | 230 Browser* browser() const { return browser_; } |
231 StripOwner strip_owner() const { return strip_owner_; } | |
221 ExpansionState expansion_state() const { return expansion_state_; } | 232 ExpansionState expansion_state() const { return expansion_state_; } |
222 ExpansionState old_expansion_state() const { return old_expansion_state_; } | |
223 const gfx::Size& min_size() const { return min_size_; } | 233 const gfx::Size& min_size() const { return min_size_; } |
224 const gfx::Size& max_size() const { return max_size_; } | 234 const gfx::Size& max_size() const { return max_size_; } |
225 bool auto_resizable() const { return auto_resizable_; } | 235 bool auto_resizable() const { return auto_resizable_; } |
226 | 236 |
227 bool draggable() const { return draggable_; } | 237 bool draggable() const { return draggable_; } |
228 void set_draggable(bool can_drag) { draggable_ = can_drag; } | 238 void set_draggable(bool can_drag) { draggable_ = can_drag; } |
229 | 239 |
230 // The restored size is the size of the panel when it is expanded. | 240 // The restored size is the size of the panel when it is expanded. |
231 gfx::Size restored_size() const { return restored_size_; } | 241 gfx::Size restored_size() const { return restored_size_; } |
232 void set_restored_size(const gfx::Size& size) { restored_size_ = size; } | 242 void set_restored_size(const gfx::Size& size) { restored_size_ = size; } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 // True if this panel auto resizes based on content. | 313 // True if this panel auto resizes based on content. |
304 bool auto_resizable_; | 314 bool auto_resizable_; |
305 | 315 |
306 // True if this panel can be dragged. | 316 // True if this panel can be dragged. |
307 bool draggable_; | 317 bool draggable_; |
308 | 318 |
309 // Platform specifc implementation for panels. It'd be one of | 319 // Platform specifc implementation for panels. It'd be one of |
310 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. | 320 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. |
311 NativePanel* native_panel_; // Weak, owns us. | 321 NativePanel* native_panel_; // Weak, owns us. |
312 | 322 |
323 StripOwner strip_owner_; | |
313 ExpansionState expansion_state_; | 324 ExpansionState expansion_state_; |
314 ExpansionState old_expansion_state_; | |
315 | 325 |
316 // Indicates whether the panel app icon is visible in the taskbar. | 326 // Indicates whether the panel app icon is visible in the taskbar. |
317 bool app_icon_visible_; | 327 bool app_icon_visible_; |
318 | 328 |
319 content::NotificationRegistrar registrar_; | 329 content::NotificationRegistrar registrar_; |
320 | 330 |
321 DISALLOW_COPY_AND_ASSIGN(Panel); | 331 DISALLOW_COPY_AND_ASSIGN(Panel); |
322 }; | 332 }; |
323 | 333 |
324 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 334 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
OLD | NEW |