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 "apps/shell_window.h" |
8 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
9 #include "chrome/browser/ui/extensions/native_app_window.h" | 10 #include "chrome/browser/ui/extensions/native_app_window.h" |
10 #include "chrome/browser/ui/extensions/shell_window.h" | |
11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.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/controls/webview/unhandled_keyboard_event_handler.h" | 15 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
16 #include "ui/views/widget/widget_delegate.h" | 16 #include "ui/views/widget/widget_delegate.h" |
17 #include "ui/views/widget/widget_observer.h" | 17 #include "ui/views/widget/widget_observer.h" |
18 | 18 |
19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
20 #include "chrome/browser/shell_integration.h" | 20 #include "chrome/browser/shell_integration.h" |
(...skipping 13 matching lines...) Expand all Loading... |
34 | 34 |
35 namespace views { | 35 namespace views { |
36 class WebView; | 36 class WebView; |
37 } | 37 } |
38 | 38 |
39 class NativeAppWindowViews : public NativeAppWindow, | 39 class NativeAppWindowViews : public NativeAppWindow, |
40 public views::WidgetDelegateView, | 40 public views::WidgetDelegateView, |
41 public views::WidgetObserver, | 41 public views::WidgetObserver, |
42 public content::WebContentsObserver { | 42 public content::WebContentsObserver { |
43 public: | 43 public: |
44 NativeAppWindowViews(ShellWindow* shell_window, | 44 NativeAppWindowViews(apps::ShellWindow* shell_window, |
45 const ShellWindow::CreateParams& params); | 45 const apps::ShellWindow::CreateParams& params); |
46 virtual ~NativeAppWindowViews(); | 46 virtual ~NativeAppWindowViews(); |
47 | 47 |
48 bool frameless() const { return frameless_; } | 48 bool frameless() const { return frameless_; } |
49 SkRegion* draggable_region() { return draggable_region_.get(); } | 49 SkRegion* draggable_region() { return draggable_region_.get(); } |
50 | 50 |
51 private: | 51 private: |
52 void InitializeDefaultWindow(const ShellWindow::CreateParams& create_params); | 52 void InitializeDefaultWindow( |
53 void InitializePanelWindow(const ShellWindow::CreateParams& create_params); | 53 const apps::ShellWindow::CreateParams& create_params); |
| 54 void InitializePanelWindow( |
| 55 const apps::ShellWindow::CreateParams& create_params); |
54 void OnViewWasResized(); | 56 void OnViewWasResized(); |
55 | 57 |
56 bool ShouldUseChromeStyleFrame() const; | 58 bool ShouldUseChromeStyleFrame() const; |
57 | 59 |
58 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
59 void OnShortcutInfoLoaded( | 61 void OnShortcutInfoLoaded( |
60 const ShellIntegration::ShortcutInfo& shortcut_info); | 62 const ShellIntegration::ShortcutInfo& shortcut_info); |
61 HWND GetNativeAppWindowHWND() const; | 63 HWND GetNativeAppWindowHWND() const; |
62 #endif | 64 #endif |
63 | 65 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 web_modal::WebContentsModalDialogHostObserver* observer) OVERRIDE; | 149 web_modal::WebContentsModalDialogHostObserver* observer) OVERRIDE; |
148 | 150 |
149 Profile* profile() { return shell_window_->profile(); } | 151 Profile* profile() { return shell_window_->profile(); } |
150 content::WebContents* web_contents() { | 152 content::WebContents* web_contents() { |
151 return shell_window_->web_contents(); | 153 return shell_window_->web_contents(); |
152 } | 154 } |
153 const extensions::Extension* extension() { | 155 const extensions::Extension* extension() { |
154 return shell_window_->extension(); | 156 return shell_window_->extension(); |
155 } | 157 } |
156 | 158 |
157 ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow. | 159 apps::ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow. |
158 views::WebView* web_view_; | 160 views::WebView* web_view_; |
159 views::Widget* window_; | 161 views::Widget* window_; |
160 bool is_fullscreen_; | 162 bool is_fullscreen_; |
161 | 163 |
162 scoped_ptr<SkRegion> draggable_region_; | 164 scoped_ptr<SkRegion> draggable_region_; |
163 | 165 |
164 const bool frameless_; | 166 const bool frameless_; |
165 const bool transparent_background_; | 167 const bool transparent_background_; |
166 gfx::Size minimum_size_; | 168 gfx::Size minimum_size_; |
167 gfx::Size maximum_size_; | 169 gfx::Size maximum_size_; |
168 gfx::Size preferred_size_; | 170 gfx::Size preferred_size_; |
169 bool resizable_; | 171 bool resizable_; |
170 | 172 |
171 // The class that registers for keyboard shortcuts for extension commands. | 173 // The class that registers for keyboard shortcuts for extension commands. |
172 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | 174 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
173 | 175 |
174 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 176 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
175 | 177 |
176 base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_; | 178 base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_; |
177 | 179 |
178 ObserverList<web_modal::WebContentsModalDialogHostObserver> observer_list_; | 180 ObserverList<web_modal::WebContentsModalDialogHostObserver> observer_list_; |
179 | 181 |
180 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); | 182 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); |
181 }; | 183 }; |
182 | 184 |
183 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ | 185 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_NATIVE_APP_WINDOW_VIEWS_H_ |
OLD | NEW |