Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: chrome/browser/ui/views/aura/panel_view_aura.h

Issue 9428018: Create BaseWindow and ExtensionWindowWrapper for extension API access to Panels (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address comments. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
19 namespace content { 22 namespace content {
20 class WebContents; 23 class WebContents;
21 } 24 }
22 25
23 namespace views { 26 namespace views {
24 class Widget; 27 class Widget;
25 } 28 }
26 29
27 namespace internal { 30 namespace internal {
28 class PanelHost; 31 class PanelHost;
29 } 32 }
30 33
31 /////////////////////////////////////////////////////////////////////////////// 34 ///////////////////////////////////////////////////////////////////////////////
32 // PanelViewAura is used to display HTML in a Panel window. 35 // PanelViewAura is used to display HTML in a Panel window.
33 // 36 //
34 class PanelViewAura : public views::NativeViewHost, 37 class PanelViewAura : public views::NativeViewHost,
35 public views::WidgetDelegate { 38 public views::WidgetDelegate,
39 public BaseWindow {
36 public: 40 public:
37 explicit PanelViewAura(const std::string& title); 41 explicit PanelViewAura(const std::string& title);
38 virtual ~PanelViewAura(); 42 virtual ~PanelViewAura();
39 43
40 views::Widget* Init(Profile* profile, 44 views::Widget* Init(Profile* profile,
41 const GURL& url, 45 const GURL& url,
42 const gfx::Rect& bounds); 46 const gfx::Rect& bounds);
43 47
44 // Returns the WebContents associated with this panel. 48 // Returns the WebContents associated with this panel.
45 content::WebContents* WebContents(); 49 content::WebContents* WebContents();
46 50
47 // Close the panel window. 51 // Close the panel window.
48 void CloseView(); 52 void CloseView();
49 53
50 // Set the preferred size of the contents. 54 // Set the preferred size of the contents.
51 void SetContentPreferredSize(const gfx::Size& size); 55 void SetContentPreferredSize(const gfx::Size& size);
52 56
57 const SessionID& session_id() const { return session_id_; }
58 ExtensionWindowController* extension_window_controller() const {
59 return extension_window_controller_.get();
60 }
61
53 // Overridden from views::View: 62 // Overridden from views::View:
54 virtual gfx::Size GetPreferredSize() OVERRIDE; 63 virtual gfx::Size GetPreferredSize() OVERRIDE;
55 64
56 // Overridden from views::WidgetDelegate: 65 // Overridden from views::WidgetDelegate:
57 virtual bool CanResize() const OVERRIDE; 66 virtual bool CanResize() const OVERRIDE;
58 virtual string16 GetWindowTitle() const OVERRIDE; 67 virtual string16 GetWindowTitle() const OVERRIDE;
59 virtual views::View* GetContentsView() OVERRIDE; 68 virtual views::View* GetContentsView() OVERRIDE;
60 virtual views::View* GetInitiallyFocusedView() OVERRIDE; 69 virtual views::View* GetInitiallyFocusedView() OVERRIDE;
61 virtual bool ShouldShowWindowTitle() const OVERRIDE; 70 virtual bool ShouldShowWindowTitle() const OVERRIDE;
62 virtual views::Widget* GetWidget() OVERRIDE; 71 virtual views::Widget* GetWidget() OVERRIDE;
63 virtual const views::Widget* GetWidget() const OVERRIDE; 72 virtual const views::Widget* GetWidget() const OVERRIDE;
64 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; 73 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
65 74
75 // Overridden from BaseWindow:
76 virtual bool IsActive() const OVERRIDE;
77 virtual bool IsMaximized() const OVERRIDE;
78 virtual bool IsMinimized() const OVERRIDE;
79 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
80 virtual gfx::Rect GetBounds() const OVERRIDE;
81 virtual void Show() OVERRIDE;
82 virtual void ShowInactive() OVERRIDE;
83 virtual void Close() OVERRIDE;
84 virtual void Activate() OVERRIDE;
85 virtual void Deactivate() OVERRIDE;
86 virtual void Maximize() OVERRIDE;
87 virtual void Minimize() OVERRIDE;
88 virtual void Restore() OVERRIDE;
89 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
90 virtual void FlashFrame(bool flash) OVERRIDE;
91
66 private: 92 private:
93 const SessionID session_id_;
67 std::string title_; 94 std::string title_;
68 gfx::Size preferred_size_; 95 gfx::Size preferred_size_;
69 // Owned internal host class implementing WebContents and Extension Delegates. 96 // Owned internal host class implementing WebContents and Extension Delegates.
70 scoped_ptr<internal::PanelHost> host_; 97 scoped_ptr<internal::PanelHost> host_;
71 // Unowned pointer to the widget. 98 // Unowned pointer to the widget.
72 views::Widget* widget_; 99 views::Widget* widget_;
100 scoped_ptr<ExtensionWindowController> extension_window_controller_;
73 101
74 DISALLOW_COPY_AND_ASSIGN(PanelViewAura); 102 DISALLOW_COPY_AND_ASSIGN(PanelViewAura);
75 }; 103 };
76 104
77 #endif // CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ 105 #endif // CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698