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_VIEWS_AURA_PANEL_VIEW_AURA_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "chrome/browser/sessions/session_id.h" | |
13 #include "chrome/browser/ui/base_window.h" | |
12 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
13 #include "ui/views/controls/native/native_view_host.h" | 15 #include "ui/views/controls/native/native_view_host.h" |
14 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
15 | 17 |
18 class ExtensionWindowController; | |
16 class GURL; | 19 class GURL; |
17 class Profile; | 20 class Profile; |
18 | 21 |
22 namespace base { | |
23 class DictionaryValue; | |
Mihai Parparita -not on Chrome
2012/02/23 02:35:36
This can be removed.
stevenjb
2012/02/23 19:57:51
Done.
| |
24 } | |
25 | |
19 namespace content { | 26 namespace content { |
20 class WebContents; | 27 class WebContents; |
21 } | 28 } |
22 | 29 |
23 namespace views { | 30 namespace views { |
24 class Widget; | 31 class Widget; |
25 } | 32 } |
26 | 33 |
27 namespace internal { | 34 namespace internal { |
28 class PanelHost; | 35 class PanelHost; |
29 } | 36 } |
30 | 37 |
31 /////////////////////////////////////////////////////////////////////////////// | 38 /////////////////////////////////////////////////////////////////////////////// |
32 // PanelViewAura is used to display HTML in a Panel window. | 39 // PanelViewAura is used to display HTML in a Panel window. |
33 // | 40 // |
34 class PanelViewAura : public views::NativeViewHost, | 41 class PanelViewAura : public views::NativeViewHost, |
35 public views::WidgetDelegate { | 42 public views::WidgetDelegate, |
43 public BaseWindow { | |
36 public: | 44 public: |
37 explicit PanelViewAura(const std::string& title); | 45 explicit PanelViewAura(const std::string& title); |
38 virtual ~PanelViewAura(); | 46 virtual ~PanelViewAura(); |
39 | 47 |
40 views::Widget* Init(Profile* profile, | 48 views::Widget* Init(Profile* profile, |
41 const GURL& url, | 49 const GURL& url, |
42 const gfx::Rect& bounds); | 50 const gfx::Rect& bounds); |
43 | 51 |
44 // Returns the WebContents associated with this panel. | 52 // Returns the WebContents associated with this panel. |
45 content::WebContents* WebContents(); | 53 content::WebContents* WebContents(); |
46 | 54 |
47 // Close the panel window. | 55 // Close the panel window. |
48 void CloseView(); | 56 void CloseView(); |
49 | 57 |
50 // Set the preferred size of the contents. | 58 // Set the preferred size of the contents. |
51 void SetContentPreferredSize(const gfx::Size& size); | 59 void SetContentPreferredSize(const gfx::Size& size); |
52 | 60 |
61 const SessionID& session_id() const { return session_id_; } | |
62 ExtensionWindowController* extension_window_controller() const { | |
63 return extension_window_controller_.get(); | |
64 } | |
65 | |
53 // Overridden from views::View: | 66 // Overridden from views::View: |
54 virtual gfx::Size GetPreferredSize() OVERRIDE; | 67 virtual gfx::Size GetPreferredSize() OVERRIDE; |
55 | 68 |
56 // Overridden from views::WidgetDelegate: | 69 // Overridden from views::WidgetDelegate: |
57 virtual bool CanResize() const OVERRIDE; | 70 virtual bool CanResize() const OVERRIDE; |
58 virtual string16 GetWindowTitle() const OVERRIDE; | 71 virtual string16 GetWindowTitle() const OVERRIDE; |
59 virtual views::View* GetContentsView() OVERRIDE; | 72 virtual views::View* GetContentsView() OVERRIDE; |
60 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 73 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
61 virtual bool ShouldShowWindowTitle() const OVERRIDE; | 74 virtual bool ShouldShowWindowTitle() const OVERRIDE; |
62 virtual views::Widget* GetWidget() OVERRIDE; | 75 virtual views::Widget* GetWidget() OVERRIDE; |
63 virtual const views::Widget* GetWidget() const OVERRIDE; | 76 virtual const views::Widget* GetWidget() const OVERRIDE; |
64 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 77 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
65 | 78 |
79 // Overridden from BaseWindow: | |
80 virtual bool IsActive() const OVERRIDE; | |
81 virtual bool IsMaximized() const OVERRIDE; | |
82 virtual bool IsMinimized() const OVERRIDE; | |
83 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | |
84 virtual gfx::Rect GetBounds() const OVERRIDE; | |
85 virtual void Show() OVERRIDE; | |
86 virtual void ShowInactive() OVERRIDE; | |
87 virtual void Close() OVERRIDE; | |
88 virtual void Activate() OVERRIDE; | |
89 virtual void Deactivate() OVERRIDE; | |
90 virtual void Maximize() OVERRIDE; | |
91 virtual void Minimize() OVERRIDE; | |
92 virtual void Restore() OVERRIDE; | |
93 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; | |
94 virtual void FlashFrame(bool flash) OVERRIDE; | |
95 | |
66 private: | 96 private: |
97 const SessionID session_id_; | |
67 std::string title_; | 98 std::string title_; |
68 gfx::Size preferred_size_; | 99 gfx::Size preferred_size_; |
69 // Owned internal host class implementing WebContents and Extension Delegates. | 100 // Owned internal host class implementing WebContents and Extension Delegates. |
70 scoped_ptr<internal::PanelHost> host_; | 101 scoped_ptr<internal::PanelHost> host_; |
71 // Unowned pointer to the widget. | 102 // Unowned pointer to the widget. |
72 views::Widget* widget_; | 103 views::Widget* widget_; |
104 scoped_ptr<ExtensionWindowController> extension_window_controller_; | |
73 | 105 |
74 DISALLOW_COPY_AND_ASSIGN(PanelViewAura); | 106 DISALLOW_COPY_AND_ASSIGN(PanelViewAura); |
75 }; | 107 }; |
76 | 108 |
77 #endif // CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ | 109 #endif // CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ |
OLD | NEW |