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_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ |
7 | 7 |
8 #include "chrome/browser/ui/base_window.h" | |
9 #include "chrome/browser/ui/extensions/native_shell_window.h" | |
8 #include "chrome/browser/ui/extensions/shell_window.h" | 10 #include "chrome/browser/ui/extensions/shell_window.h" |
9 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/scoped_sk_region.h" | 12 #include "ui/gfx/scoped_sk_region.h" |
11 #include "ui/views/widget/widget_delegate.h" | 13 #include "ui/views/widget/widget_delegate.h" |
12 | 14 |
13 class Profile; | 15 class Profile; |
14 | 16 |
17 namespace content { | |
18 class WebContents; | |
19 } | |
20 | |
15 namespace extensions { | 21 namespace extensions { |
16 class Extension; | 22 class Extension; |
17 struct DraggableRegion; | 23 struct DraggableRegion; |
18 } | 24 } |
19 | 25 |
20 namespace views { | 26 namespace views { |
21 class WebView; | 27 class WebView; |
22 } | 28 } |
23 | 29 |
24 class ShellWindowViews : public ShellWindow, | 30 class ShellWindowViews : public NativeShellWindow, |
25 public views::WidgetDelegateView { | 31 public views::WidgetDelegateView { |
26 public: | 32 public: |
27 ShellWindowViews(Profile* profile, | 33 ShellWindowViews(ShellWindow* shell_window, |
28 const extensions::Extension* extension, | 34 const ShellWindow::CreateParams& params); |
29 const GURL& url, | |
30 const CreateParams& params); | |
31 | 35 |
32 bool frameless() const { return frameless_; } | 36 bool frameless() const { return frameless_; } |
33 SkRegion* draggable_region() { return draggable_region_.Get(); } | 37 SkRegion* draggable_region() { return draggable_region_.Get(); } |
34 | 38 |
35 // BaseWindow implementation. | 39 // BaseWindow implementation. |
36 virtual bool IsActive() const OVERRIDE; | 40 virtual bool IsActive() const OVERRIDE; |
37 virtual bool IsMaximized() const OVERRIDE; | 41 virtual bool IsMaximized() const OVERRIDE; |
38 virtual bool IsMinimized() const OVERRIDE; | 42 virtual bool IsMinimized() const OVERRIDE; |
39 virtual bool IsFullscreen() const OVERRIDE; | 43 virtual bool IsFullscreen() const OVERRIDE; |
40 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 44 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
(...skipping 25 matching lines...) Expand all Loading... | |
66 | 70 |
67 protected: | 71 protected: |
68 // views::View implementation. | 72 // views::View implementation. |
69 virtual void Layout() OVERRIDE; | 73 virtual void Layout() OVERRIDE; |
70 virtual void ViewHierarchyChanged( | 74 virtual void ViewHierarchyChanged( |
71 bool is_add, views::View *parent, views::View *child) OVERRIDE; | 75 bool is_add, views::View *parent, views::View *child) OVERRIDE; |
72 virtual gfx::Size GetMinimumSize() OVERRIDE; | 76 virtual gfx::Size GetMinimumSize() OVERRIDE; |
73 virtual gfx::Size GetMaximumSize() OVERRIDE; | 77 virtual gfx::Size GetMaximumSize() OVERRIDE; |
74 virtual void OnFocus() OVERRIDE; | 78 virtual void OnFocus() OVERRIDE; |
75 | 79 |
76 // ShellWindow implementation. | 80 // NativeShellWindow implementation. |
77 virtual void UpdateWindowTitle() OVERRIDE; | 81 virtual void UpdateWindowTitle() OVERRIDE; |
78 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 82 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
79 virtual bool IsFullscreenOrPending() const OVERRIDE; | 83 virtual bool IsFullscreenOrPending() const OVERRIDE; |
80 | 84 |
85 virtual Profile* profile() { return shell_window_->profile(); } | |
86 virtual content::WebContents* web_contents() { | |
tfarina
2012/08/09 16:20:20
Does these needs to be virtual? In any case, virtu
jeremya
2012/08/09 23:59:53
Not really :)
| |
87 return shell_window_->web_contents(); | |
88 } | |
89 virtual const extensions::Extension* extension() { | |
90 return shell_window_->extension(); | |
91 } | |
92 | |
81 private: | 93 private: |
82 friend class ShellWindowFrameView; | 94 friend class ShellWindowFrameView; |
83 | 95 |
84 virtual ~ShellWindowViews(); | 96 virtual ~ShellWindowViews(); |
85 | 97 |
86 // content::WebContentsDelegate implementation. | 98 // content::WebContentsDelegate implementation. |
87 virtual void UpdateDraggableRegions( | 99 virtual void UpdateDraggableRegions( |
88 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; | 100 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; |
89 | 101 |
90 void OnViewWasResized(); | 102 void OnViewWasResized(); |
91 | 103 |
92 views::WebView* web_view_; | 104 views::WebView* web_view_; |
93 views::Widget* window_; | 105 views::Widget* window_; |
94 bool is_fullscreen_; | 106 bool is_fullscreen_; |
95 | 107 |
96 gfx::ScopedSkRegion draggable_region_; | 108 gfx::ScopedSkRegion draggable_region_; |
97 | 109 |
98 bool frameless_; | 110 bool frameless_; |
99 gfx::Size minimum_size_; | 111 gfx::Size minimum_size_; |
100 gfx::Size maximum_size_; | 112 gfx::Size maximum_size_; |
101 | 113 |
114 ShellWindow* shell_window_; | |
115 | |
102 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); | 116 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); |
103 }; | 117 }; |
104 | 118 |
105 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 119 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ |
OLD | NEW |