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 "third_party/skia/include/core/SkRegion.h" | 11 #include "third_party/skia/include/core/SkRegion.h" |
10 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.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 |
| 80 Profile* profile() { return shell_window_->profile(); } |
| 81 content::WebContents* web_contents() { |
| 82 return shell_window_->web_contents(); |
| 83 } |
| 84 const extensions::Extension* extension() { |
| 85 return shell_window_->extension(); |
| 86 } |
| 87 |
76 private: | 88 private: |
77 friend class ShellWindowFrameView; | 89 friend class ShellWindowFrameView; |
78 | 90 |
79 virtual ~ShellWindowViews(); | 91 virtual ~ShellWindowViews(); |
80 | 92 |
81 // ShellWindow implementation. | 93 // NativeShellWindow implementation. |
82 virtual void UpdateWindowTitle() OVERRIDE; | 94 virtual void UpdateWindowTitle() OVERRIDE; |
83 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 95 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
84 virtual bool IsFullscreenOrPending() const OVERRIDE; | 96 virtual bool IsFullscreenOrPending() const OVERRIDE; |
85 virtual void UpdateDraggableRegions( | 97 virtual void UpdateDraggableRegions( |
86 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; | 98 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; |
87 | 99 |
88 void OnViewWasResized(); | 100 void OnViewWasResized(); |
89 | 101 |
| 102 ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow. |
| 103 |
90 views::WebView* web_view_; | 104 views::WebView* web_view_; |
91 views::Widget* window_; | 105 views::Widget* window_; |
92 bool is_fullscreen_; | 106 bool is_fullscreen_; |
93 | 107 |
94 scoped_ptr<SkRegion> draggable_region_; | 108 scoped_ptr<SkRegion> draggable_region_; |
95 | 109 |
96 bool frameless_; | 110 bool frameless_; |
97 gfx::Size minimum_size_; | 111 gfx::Size minimum_size_; |
98 gfx::Size maximum_size_; | 112 gfx::Size maximum_size_; |
99 | 113 |
100 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); | 114 DISALLOW_COPY_AND_ASSIGN(ShellWindowViews); |
101 }; | 115 }; |
102 | 116 |
103 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ | 117 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_ |
OLD | NEW |