OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "chrome/browser/sessions/session_id.h" | |
13 #include "chrome/browser/ui/base_window.h" | |
14 #include "ui/gfx/size.h" | |
15 #include "ui/views/controls/native/native_view_host.h" | |
16 #include "ui/views/widget/widget_delegate.h" | |
17 | |
18 class ExtensionWindowController; | |
19 class GURL; | |
20 class Profile; | |
21 | |
22 namespace content { | |
23 class WebContents; | |
24 } | |
25 | |
26 namespace views { | |
27 class Widget; | |
28 } | |
29 | |
30 namespace internal { | |
31 class PanelHost; | |
32 } | |
33 | |
34 /////////////////////////////////////////////////////////////////////////////// | |
35 // PanelViewAura is used to display HTML in a Panel window. | |
36 // | |
37 class PanelViewAura : public views::NativeViewHost, | |
38 public views::WidgetDelegate, | |
39 public BaseWindow { | |
40 public: | |
41 explicit PanelViewAura(const std::string& title); | |
42 virtual ~PanelViewAura(); | |
43 | |
44 views::Widget* Init(Profile* profile, | |
45 const GURL& url, | |
46 const gfx::Rect& bounds); | |
47 | |
48 // Returns the WebContents associated with this panel. | |
49 content::WebContents* WebContents(); | |
50 | |
51 // Close the panel window. | |
52 void CloseView(); | |
53 | |
54 // Set the preferred size of the contents. | |
55 void SetContentPreferredSize(const gfx::Size& size); | |
56 | |
57 const SessionID& session_id() const { return session_id_; } | |
58 ExtensionWindowController* extension_window_controller() const { | |
59 return extension_window_controller_.get(); | |
60 } | |
61 | |
62 // Overridden from views::View: | |
63 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
64 | |
65 // Overridden from views::WidgetDelegate: | |
66 virtual bool CanResize() const OVERRIDE; | |
67 virtual string16 GetWindowTitle() const OVERRIDE; | |
68 virtual views::View* GetContentsView() OVERRIDE; | |
69 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | |
70 virtual bool ShouldShowWindowTitle() const OVERRIDE; | |
71 virtual views::Widget* GetWidget() OVERRIDE; | |
72 virtual const views::Widget* GetWidget() const OVERRIDE; | |
73 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | |
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 | |
92 private: | |
93 const SessionID session_id_; | |
94 std::string title_; | |
95 gfx::Size preferred_size_; | |
96 // Owned internal host class implementing WebContents and Extension Delegates. | |
97 scoped_ptr<internal::PanelHost> host_; | |
98 // Unowned pointer to the widget. | |
99 views::Widget* widget_; | |
100 scoped_ptr<ExtensionWindowController> extension_window_controller_; | |
101 | |
102 DISALLOW_COPY_AND_ASSIGN(PanelViewAura); | |
103 }; | |
104 | |
105 #endif // CHROME_BROWSER_UI_VIEWS_AURA_PANEL_VIEW_AURA_H_ | |
OLD | NEW |