| 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_PANEL_BROWSER_WINDOW_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_COCOA_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_COCOA_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 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 "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 class Panel; | 15 class Panel; |
| 16 @class PanelWindowControllerCocoa; | 16 @class PanelWindowControllerCocoa; |
| 17 | 17 |
| 18 // An implementation of BrowserWindow for native Panel in Cocoa. | 18 // An implementation of BrowserWindow for native Panel in Cocoa. |
| 19 // Bridges between C++ and the Cocoa NSWindow. Cross-platform code will | 19 // Bridges between C++ and the Cocoa NSWindow. Cross-platform code will |
| 20 // interact with this object when it needs to manipulate the window. | 20 // interact with this object when it needs to manipulate the window. |
| 21 | 21 |
| 22 class PanelBrowserWindowCocoa : public NativePanel, | 22 class PanelBrowserWindowCocoa : public NativePanel { |
| 23 public NativePanelTesting { | |
| 24 public: | 23 public: |
| 25 PanelBrowserWindowCocoa(Browser* browser, Panel* panel, | 24 PanelBrowserWindowCocoa(Browser* browser, Panel* panel, |
| 26 const gfx::Rect& bounds); | 25 const gfx::Rect& bounds); |
| 27 virtual ~PanelBrowserWindowCocoa(); | 26 virtual ~PanelBrowserWindowCocoa(); |
| 28 | 27 |
| 29 // Overridden from NativePanel | 28 // Overridden from NativePanel |
| 30 virtual void ShowPanel() OVERRIDE; | 29 virtual void ShowPanel() OVERRIDE; |
| 31 virtual void ShowPanelInactive() OVERRIDE; | 30 virtual void ShowPanelInactive() OVERRIDE; |
| 32 virtual gfx::Rect GetPanelBounds() const OVERRIDE; | 31 virtual gfx::Rect GetPanelBounds() const OVERRIDE; |
| 33 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; | 32 virtual void SetPanelBounds(const gfx::Rect& bounds) OVERRIDE; |
| 34 virtual void OnPanelExpansionStateChanged( | 33 virtual void OnPanelExpansionStateChanged( |
| 35 Panel::ExpansionState expansion_state) OVERRIDE; | 34 Panel::ExpansionState expansion_state) OVERRIDE; |
| 36 virtual bool ShouldBringUpPanelTitleBar(int mouse_x, | 35 virtual bool ShouldBringUpPanelTitleBar(int mouse_x, |
| 37 int mouse_y) const OVERRIDE; | 36 int mouse_y) const OVERRIDE; |
| 38 virtual void ClosePanel() OVERRIDE; | 37 virtual void ClosePanel() OVERRIDE; |
| 39 virtual void ActivatePanel() OVERRIDE; | 38 virtual void ActivatePanel() OVERRIDE; |
| 40 virtual void DeactivatePanel() OVERRIDE; | 39 virtual void DeactivatePanel() OVERRIDE; |
| 41 virtual bool IsPanelActive() const OVERRIDE; | 40 virtual bool IsPanelActive() const OVERRIDE; |
| 42 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; | 41 virtual gfx::NativeWindow GetNativePanelHandle() OVERRIDE; |
| 43 virtual void UpdatePanelTitleBar() OVERRIDE; | 42 virtual void UpdatePanelTitleBar() OVERRIDE; |
| 44 virtual void ShowTaskManagerForPanel() OVERRIDE; | 43 virtual void ShowTaskManagerForPanel() OVERRIDE; |
| 45 virtual FindBar* CreatePanelFindBar() OVERRIDE; | 44 virtual FindBar* CreatePanelFindBar() OVERRIDE; |
| 46 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; | 45 virtual void NotifyPanelOnUserChangedTheme() OVERRIDE; |
| 47 virtual void DrawAttention() OVERRIDE; | 46 virtual void DrawAttention() OVERRIDE; |
| 48 virtual bool IsDrawingAttention() const OVERRIDE; | 47 virtual bool IsDrawingAttention() const OVERRIDE; |
| 49 virtual Browser* GetPanelBrowser() const OVERRIDE; | 48 virtual Browser* GetPanelBrowser() const OVERRIDE; |
| 50 virtual void DestroyPanelBrowser() OVERRIDE; | 49 virtual void DestroyPanelBrowser() OVERRIDE; |
| 51 virtual NativePanelTesting* GetNativePanelTesting() OVERRIDE; | |
| 52 | 50 |
| 53 Panel* panel() { return panel_.get(); } | 51 Panel* panel() { return panel_.get(); } |
| 54 Browser* browser() const { return browser_.get(); } | 52 Browser* browser() const { return browser_.get(); } |
| 55 | 53 |
| 56 private: | 54 private: |
| 57 friend class PanelBrowserWindowCocoaTest; | 55 friend class PanelBrowserWindowCocoaTest; |
| 58 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, CreateClose); | 56 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, CreateClose); |
| 59 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, NativeBounds); | 57 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, NativeBounds); |
| 60 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, TitlebarViewCreate); | 58 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, TitlebarViewCreate); |
| 61 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, TitlebarViewSizing); | 59 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, TitlebarViewSizing); |
| 62 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, TitlebarViewClose); | 60 FRIEND_TEST_ALL_PREFIXES(PanelBrowserWindowCocoaTest, TitlebarViewClose); |
| 63 | 61 |
| 64 bool isClosed(); | 62 bool isClosed(); |
| 65 | 63 |
| 66 scoped_ptr<Browser> browser_; | 64 scoped_ptr<Browser> browser_; |
| 67 scoped_ptr<Panel> panel_; | 65 scoped_ptr<Panel> panel_; |
| 68 gfx::Rect bounds_; | 66 gfx::Rect bounds_; |
| 69 PanelWindowControllerCocoa* controller_; // Weak, owns us. | 67 PanelWindowControllerCocoa* controller_; // Weak, owns us. |
| 70 bool is_shown_; // Panel is hidden on creation, Show() changes that forever. | 68 bool is_shown_; // Panel is hidden on creation, Show() changes that forever. |
| 71 bool has_find_bar_; // Find bar should only be created once per panel. | 69 bool has_find_bar_; // Find bar should only be created once per panel. |
| 72 | 70 |
| 73 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowCocoa); | 71 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowCocoa); |
| 74 }; | 72 }; |
| 75 | 73 |
| 76 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_COCOA_H_ | 74 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_COCOA_H_ |
| OLD | NEW |