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 LayoutState { |
| 36 // The panel is docked to the bottom of the screen. |
| 37 DOCKED, |
| 38 // The panel can appear anywhere on the screen. |
| 39 DETACHED, |
| 40 // The panel is put into the overflow area due to insufficient space in the |
| 41 // docked display area. |
| 42 IN_OVERFLOW |
| 43 }; |
| 44 |
35 enum ExpansionState { | 45 enum ExpansionState { |
36 // The panel is fully expanded with both title-bar and the client-area. | 46 // The panel is fully expanded with both title-bar and the client-area. |
37 EXPANDED, | 47 EXPANDED, |
38 // The panel is shown with the title-bar only. | 48 // The panel is shown with the title-bar only. |
39 TITLE_ONLY, | 49 TITLE_ONLY, |
40 // The panel is shown with 3-pixel line. | 50 // The panel is shown with 3-pixel line. |
41 MINIMIZED, | 51 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 }; | 52 }; |
46 | 53 |
47 // The panel can be minimized to 4-pixel lines. | 54 // The panel can be minimized to 4-pixel lines. |
48 static const int kMinimizedPanelHeight = 4; | 55 static const int kMinimizedPanelHeight = 4; |
49 | 56 |
50 virtual ~Panel(); | 57 virtual ~Panel(); |
51 | 58 |
52 // Returns the PanelManager associated with this panel. | 59 // Returns the PanelManager associated with this panel. |
53 PanelManager* manager() const; | 60 PanelManager* manager() const; |
54 | 61 |
55 // Gets the extension that a panel is created from. | 62 // Gets the extension that a panel is created from. |
56 // Returns NULL if it cannot be found. | 63 // Returns NULL if it cannot be found. |
57 const Extension* GetExtension() const; | 64 const Extension* GetExtension() const; |
58 | 65 |
| 66 void SetLayoutState(LayoutState new_layout_state); |
59 void SetExpansionState(ExpansionState new_expansion_state); | 67 void SetExpansionState(ExpansionState new_expansion_state); |
60 | 68 |
61 bool IsDrawingAttention() const; | 69 bool IsDrawingAttention() const; |
62 | 70 |
63 // This function will only get called by PanelManager when full screen mode | 71 // 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 | 72 // 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 | 73 // 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. | 74 // 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. | 75 // b) it remains on top when an app exits full screen mode. |
68 void FullScreenModeChanged(bool is_full_screen); | 76 void FullScreenModeChanged(bool is_full_screen); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 219 |
212 // Used on platforms where the panel cannot determine its window size | 220 // Used on platforms where the panel cannot determine its window size |
213 // until the window has been created. (e.g. GTK) | 221 // until the window has been created. (e.g. GTK) |
214 void OnWindowSizeAvailable(); | 222 void OnWindowSizeAvailable(); |
215 | 223 |
216 // Asynchronous completion of panel close request. | 224 // Asynchronous completion of panel close request. |
217 void OnNativePanelClosed(); | 225 void OnNativePanelClosed(); |
218 | 226 |
219 NativePanel* native_panel() { return native_panel_; } | 227 NativePanel* native_panel() { return native_panel_; } |
220 Browser* browser() const { return browser_; } | 228 Browser* browser() const { return browser_; } |
| 229 LayoutState layout_state() const { return layout_state_; } |
221 ExpansionState expansion_state() const { return expansion_state_; } | 230 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_; } | 231 const gfx::Size& min_size() const { return min_size_; } |
224 const gfx::Size& max_size() const { return max_size_; } | 232 const gfx::Size& max_size() const { return max_size_; } |
225 bool auto_resizable() const { return auto_resizable_; } | 233 bool auto_resizable() const { return auto_resizable_; } |
226 | 234 |
227 bool draggable() const { return draggable_; } | 235 bool draggable() const { return draggable_; } |
228 void set_draggable(bool can_drag) { draggable_ = can_drag; } | 236 void set_draggable(bool can_drag) { draggable_ = can_drag; } |
229 | 237 |
230 // The restored size is the size of the panel when it is expanded. | 238 // The restored size is the size of the panel when it is expanded. |
231 gfx::Size restored_size() const { return restored_size_; } | 239 gfx::Size restored_size() const { return restored_size_; } |
232 void set_restored_size(const gfx::Size& size) { restored_size_ = size; } | 240 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. | 311 // True if this panel auto resizes based on content. |
304 bool auto_resizable_; | 312 bool auto_resizable_; |
305 | 313 |
306 // True if this panel can be dragged. | 314 // True if this panel can be dragged. |
307 bool draggable_; | 315 bool draggable_; |
308 | 316 |
309 // Platform specifc implementation for panels. It'd be one of | 317 // Platform specifc implementation for panels. It'd be one of |
310 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. | 318 // PanelBrowserWindowGtk/PanelBrowserView/PanelBrowserWindowCocoa. |
311 NativePanel* native_panel_; // Weak, owns us. | 319 NativePanel* native_panel_; // Weak, owns us. |
312 | 320 |
| 321 LayoutState layout_state_; |
313 ExpansionState expansion_state_; | 322 ExpansionState expansion_state_; |
314 ExpansionState old_expansion_state_; | |
315 | 323 |
316 // Indicates whether the panel app icon is visible in the taskbar. | 324 // Indicates whether the panel app icon is visible in the taskbar. |
317 bool app_icon_visible_; | 325 bool app_icon_visible_; |
318 | 326 |
319 content::NotificationRegistrar registrar_; | 327 content::NotificationRegistrar registrar_; |
320 | 328 |
321 DISALLOW_COPY_AND_ASSIGN(Panel); | 329 DISALLOW_COPY_AND_ASSIGN(Panel); |
322 }; | 330 }; |
323 | 331 |
324 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 332 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
OLD | NEW |