Chromium Code Reviews| 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_NATIVE_PANEL_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ | 6 #define CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 // 2. We need some additional methods that BrowserWindow doesn't provide, such | 25 // 2. We need some additional methods that BrowserWindow doesn't provide, such |
| 26 // as MinimizePanel() and RestorePanel(). | 26 // as MinimizePanel() and RestorePanel(). |
| 27 // Note that even though we don't use BrowserWindow directly, Windows and GTK+ | 27 // Note that even though we don't use BrowserWindow directly, Windows and GTK+ |
| 28 // still use the BrowserWindow interface as part of their implementation so we | 28 // still use the BrowserWindow interface as part of their implementation so we |
| 29 // use Panel in all the method names to avoid collisions. | 29 // use Panel in all the method names to avoid collisions. |
| 30 class NativePanel { | 30 class NativePanel { |
| 31 friend class Panel; | 31 friend class Panel; |
| 32 friend class PanelBrowserTest; | 32 friend class PanelBrowserTest; |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 enum PanelIconState { | |
| 36 SHOW_ICON_IN_DESKTOP_BAR, | |
| 37 HIDE_ICON_IN_DESKTOP_BAR | |
| 38 }; | |
| 39 | |
| 35 virtual ~NativePanel() {} | 40 virtual ~NativePanel() {} |
| 36 | 41 |
| 37 virtual void ShowPanel() = 0; | 42 virtual void ShowPanel() = 0; |
| 38 virtual void ShowPanelInactive() = 0; | 43 virtual void ShowPanelInactive() = 0; |
| 39 virtual gfx::Rect GetPanelBounds() const = 0; | 44 virtual gfx::Rect GetPanelBounds() const = 0; |
| 40 virtual void SetPanelBounds(const gfx::Rect& bounds) = 0; | 45 virtual void SetPanelBounds(const gfx::Rect& bounds) = 0; |
| 41 virtual void ClosePanel() = 0; | 46 virtual void ClosePanel() = 0; |
| 42 virtual void ActivatePanel() = 0; | 47 virtual void ActivatePanel() = 0; |
| 43 virtual void DeactivatePanel() = 0; | 48 virtual void DeactivatePanel() = 0; |
| 44 virtual bool IsPanelActive() const = 0; | 49 virtual bool IsPanelActive() const = 0; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 63 virtual void DestroyPanelBrowser() = 0; | 68 virtual void DestroyPanelBrowser() = 0; |
| 64 | 69 |
| 65 // Returns the exterior size of the panel window given the client content | 70 // Returns the exterior size of the panel window given the client content |
| 66 // size and vice versa. | 71 // size and vice versa. |
| 67 virtual gfx::Size WindowSizeFromContentSize( | 72 virtual gfx::Size WindowSizeFromContentSize( |
| 68 const gfx::Size& content_size) const = 0; | 73 const gfx::Size& content_size) const = 0; |
| 69 virtual gfx::Size ContentSizeFromWindowSize( | 74 virtual gfx::Size ContentSizeFromWindowSize( |
| 70 const gfx::Size& window_size) const = 0; | 75 const gfx::Size& window_size) const = 0; |
| 71 | 76 |
| 72 virtual int TitleOnlyHeight() const = 0; | 77 virtual int TitleOnlyHeight() const = 0; |
| 78 | |
| 79 // Returns the size of the iconified panel. This is the size we use to draw | |
| 80 // the panel put in the overflow area. | |
| 81 virtual gfx::Size GetIconifiedPanelSize() const = 0; | |
|
jennb
2011/11/24 01:16:28
Is this the size when not hovering on the overflow
jianli
2011/11/24 01:47:10
This method only intends to return platform-specif
| |
| 82 | |
| 83 // Brings the panel to the top of the z-order without activating it. This | |
| 84 // will make sure that the panel is not obscured by other top-most windows. | |
| 85 virtual void EnsurePanelFullyVisible() = 0; | |
| 86 | |
| 87 // Controls if the panel icon should appear in the taskbar or the dock. | |
|
jennb
2011/11/24 01:16:28
Does this concept apply to Mac? If not, then just
jianli
2011/11/24 01:47:10
Yes.
| |
| 88 virtual void UpdatePanelIconInDesktopBar(PanelIconState state) = 0; | |
| 73 }; | 89 }; |
| 74 | 90 |
| 75 // A NativePanel utility interface used for accessing elements of the | 91 // A NativePanel utility interface used for accessing elements of the |
| 76 // native panel used only by test automation. | 92 // native panel used only by test automation. |
| 77 class NativePanelTesting { | 93 class NativePanelTesting { |
| 78 public: | 94 public: |
| 79 static NativePanelTesting* Create(NativePanel* native_panel); | 95 static NativePanelTesting* Create(NativePanel* native_panel); |
| 80 virtual ~NativePanelTesting() {} | 96 virtual ~NativePanelTesting() {} |
| 81 | 97 |
| 82 virtual void PressLeftMouseButtonTitlebar(const gfx::Point& point) = 0; | 98 virtual void PressLeftMouseButtonTitlebar(const gfx::Point& point) = 0; |
| 83 virtual void ReleaseMouseButtonTitlebar() = 0; | 99 virtual void ReleaseMouseButtonTitlebar() = 0; |
| 84 virtual void DragTitlebar(int delta_x, int delta_y) = 0; | 100 virtual void DragTitlebar(int delta_x, int delta_y) = 0; |
| 85 virtual void CancelDragTitlebar() = 0; | 101 virtual void CancelDragTitlebar() = 0; |
| 86 virtual void FinishDragTitlebar() = 0; | 102 virtual void FinishDragTitlebar() = 0; |
| 87 | 103 |
| 88 // Verifies, on a deepest possible level, if the Panel is showing the "Draw | 104 // Verifies, on a deepest possible level, if the Panel is showing the "Draw |
| 89 // Attention" effects to the user. May include checking colors etc. | 105 // Attention" effects to the user. May include checking colors etc. |
| 90 virtual bool VerifyDrawingAttention() const = 0; | 106 virtual bool VerifyDrawingAttention() const = 0; |
| 91 // Verifies, on a deepest possible level, if the native panel is really | 107 // Verifies, on a deepest possible level, if the native panel is really |
| 92 // active, i.e. the titlebar is painted per its active state. | 108 // active, i.e. the titlebar is painted per its active state. |
| 93 virtual bool VerifyActiveState(bool is_active) = 0; | 109 virtual bool VerifyActiveState(bool is_active) = 0; |
| 94 virtual void WaitForWindowCreationToComplete() const { } | 110 virtual void WaitForWindowCreationToComplete() const { } |
| 95 | 111 |
| 96 virtual bool IsWindowSizeKnown() const = 0; | 112 virtual bool IsWindowSizeKnown() const = 0; |
| 97 virtual bool IsAnimatingBounds() const = 0; | 113 virtual bool IsAnimatingBounds() const = 0; |
| 98 }; | 114 }; |
| 99 | 115 |
| 100 #endif // CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ | 116 #endif // CHROME_BROWSER_UI_PANELS_NATIVE_PANEL_H_ |
| OLD | NEW |