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_NATIVE_APP_WINDOW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ |
7 | 7 |
8 #include "chrome/browser/ui/base_window.h" | 8 #include "chrome/browser/ui/base_window.h" |
9 #include "chrome/browser/ui/extensions/native_app_window.h" | 9 #include "chrome/browser/ui/extensions/native_app_window.h" |
10 #include "chrome/browser/ui/extensions/shell_window.h" | 10 #include "chrome/browser/ui/extensions/shell_window.h" |
11 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" | 11 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" |
12 #include "third_party/skia/include/core/SkRegion.h" | 12 #include "third_party/skia/include/core/SkRegion.h" |
13 #include "ui/gfx/image/image_skia.h" | 13 #include "ui/gfx/image/image_skia.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 #include "ui/views/widget/widget_delegate.h" | 15 #include "ui/views/widget/widget_delegate.h" |
16 #include "ui/views/widget/widget_observer.h" | 16 #include "ui/views/widget/widget_observer.h" |
17 | 17 |
18 class ExtensionKeybindingRegistryViews; | 18 class ExtensionKeybindingRegistryViews; |
19 class Profile; | 19 class Profile; |
20 | 20 |
21 namespace content { | 21 namespace content { |
| 22 class RenderViewHost; |
22 class WebContents; | 23 class WebContents; |
23 } | 24 } |
24 | 25 |
25 namespace extensions { | 26 namespace extensions { |
26 class Extension; | 27 class Extension; |
27 } | 28 } |
28 | 29 |
29 namespace views { | 30 namespace views { |
30 class WebView; | 31 class WebView; |
31 } | 32 } |
32 | 33 |
33 class NativeAppWindowViews : public NativeAppWindow, | 34 class NativeAppWindowViews : public NativeAppWindow, |
34 public views::WidgetDelegateView, | 35 public views::WidgetDelegateView, |
35 public views::WidgetObserver { | 36 public views::WidgetObserver, |
| 37 public content::WebContentsObserver { |
36 public: | 38 public: |
37 NativeAppWindowViews(ShellWindow* shell_window, | 39 NativeAppWindowViews(ShellWindow* shell_window, |
38 const ShellWindow::CreateParams& params); | 40 const ShellWindow::CreateParams& params); |
39 virtual ~NativeAppWindowViews(); | 41 virtual ~NativeAppWindowViews(); |
40 | 42 |
41 bool frameless() const { return frameless_; } | 43 bool frameless() const { return frameless_; } |
42 SkRegion* draggable_region() { return draggable_region_.get(); } | 44 SkRegion* draggable_region() { return draggable_region_.get(); } |
43 | 45 |
44 private: | 46 private: |
45 void InitializeDefaultWindow(const ShellWindow::CreateParams& create_params); | 47 void InitializeDefaultWindow(const ShellWindow::CreateParams& create_params); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 virtual bool ShouldDescendIntoChildForEventHandling( | 89 virtual bool ShouldDescendIntoChildForEventHandling( |
88 gfx::NativeView child, | 90 gfx::NativeView child, |
89 const gfx::Point& location) OVERRIDE; | 91 const gfx::Point& location) OVERRIDE; |
90 | 92 |
91 // WidgetObserver implementation. | 93 // WidgetObserver implementation. |
92 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 94 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
93 bool visible) OVERRIDE; | 95 bool visible) OVERRIDE; |
94 virtual void OnWidgetActivationChanged(views::Widget* widget, | 96 virtual void OnWidgetActivationChanged(views::Widget* widget, |
95 bool active) OVERRIDE; | 97 bool active) OVERRIDE; |
96 | 98 |
| 99 // WebContentsObserver implementation. |
| 100 virtual void RenderViewCreated( |
| 101 content::RenderViewHost* render_view_host) OVERRIDE; |
| 102 |
97 // views::View implementation. | 103 // views::View implementation. |
98 virtual void Layout() OVERRIDE; | 104 virtual void Layout() OVERRIDE; |
99 virtual void ViewHierarchyChanged( | 105 virtual void ViewHierarchyChanged( |
100 bool is_add, views::View *parent, views::View *child) OVERRIDE; | 106 bool is_add, views::View *parent, views::View *child) OVERRIDE; |
101 virtual gfx::Size GetPreferredSize() OVERRIDE; | 107 virtual gfx::Size GetPreferredSize() OVERRIDE; |
102 virtual gfx::Size GetMinimumSize() OVERRIDE; | 108 virtual gfx::Size GetMinimumSize() OVERRIDE; |
103 virtual gfx::Size GetMaximumSize() OVERRIDE; | 109 virtual gfx::Size GetMaximumSize() OVERRIDE; |
104 virtual void OnFocus() OVERRIDE; | 110 virtual void OnFocus() OVERRIDE; |
105 | 111 |
106 // NativeAppWindow implementation. | 112 // NativeAppWindow implementation. |
(...skipping 16 matching lines...) Expand all Loading... |
123 return shell_window_->extension(); | 129 return shell_window_->extension(); |
124 } | 130 } |
125 | 131 |
126 ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow. | 132 ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow. |
127 views::WebView* web_view_; | 133 views::WebView* web_view_; |
128 views::Widget* window_; | 134 views::Widget* window_; |
129 bool is_fullscreen_; | 135 bool is_fullscreen_; |
130 | 136 |
131 scoped_ptr<SkRegion> draggable_region_; | 137 scoped_ptr<SkRegion> draggable_region_; |
132 | 138 |
133 bool frameless_; | 139 const bool frameless_; |
| 140 const bool transparent_background_; |
134 gfx::Size minimum_size_; | 141 gfx::Size minimum_size_; |
135 gfx::Size maximum_size_; | 142 gfx::Size maximum_size_; |
136 gfx::Size preferred_size_; | 143 gfx::Size preferred_size_; |
137 | 144 |
138 // The class that registers for keyboard shortcuts for extension commands. | 145 // The class that registers for keyboard shortcuts for extension commands. |
139 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | 146 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
140 | 147 |
141 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 148 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
142 | 149 |
143 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); | 150 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); |
144 }; | 151 }; |
145 | 152 |
146 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ | 153 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ |
OLD | NEW |