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_EXTENSIONS_SHELL_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
6 #define CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/extensions/extension_keybinding_registry.h" | 10 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
11 #include "chrome/browser/sessions/session_id.h" | 11 #include "chrome/browser/sessions/session_id.h" |
12 #include "chrome/browser/ui/base_window.h" | 12 #include "chrome/browser/ui/base_window.h" |
| 13 #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h" |
13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
15 #include "content/public/browser/web_contents_delegate.h" | 16 #include "content/public/browser/web_contents_delegate.h" |
16 #include "content/public/common/console_message_level.h" | 17 #include "content/public/common/console_message_level.h" |
17 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
18 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
19 | 20 |
20 class GURL; | 21 class GURL; |
21 class Profile; | 22 class Profile; |
22 class NativeAppWindow; | 23 class NativeAppWindow; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 virtual content::WebContents* GetWebContents() const = 0; | 58 virtual content::WebContents* GetWebContents() const = 0; |
58 | 59 |
59 private: | 60 private: |
60 DISALLOW_COPY_AND_ASSIGN(ShellWindowContents); | 61 DISALLOW_COPY_AND_ASSIGN(ShellWindowContents); |
61 }; | 62 }; |
62 | 63 |
63 // ShellWindow is the type of window used by platform apps. Shell windows | 64 // ShellWindow is the type of window used by platform apps. Shell windows |
64 // have a WebContents but none of the chrome of normal browser windows. | 65 // have a WebContents but none of the chrome of normal browser windows. |
65 class ShellWindow : public content::NotificationObserver, | 66 class ShellWindow : public content::NotificationObserver, |
66 public content::WebContentsDelegate, | 67 public content::WebContentsDelegate, |
67 public extensions::ExtensionKeybindingRegistry::Delegate { | 68 public extensions::ExtensionKeybindingRegistry::Delegate, |
| 69 public WebContentsModalDialogManagerDelegate { |
68 public: | 70 public: |
69 enum WindowType { | 71 enum WindowType { |
70 WINDOW_TYPE_DEFAULT, // Default shell window | 72 WINDOW_TYPE_DEFAULT, // Default shell window |
71 WINDOW_TYPE_PANEL, // OS controlled panel window (Ash only) | 73 WINDOW_TYPE_PANEL, // OS controlled panel window (Ash only) |
72 WINDOW_TYPE_V1_PANEL, // For apps v1 support in Ash; deprecate with v1 apps | 74 WINDOW_TYPE_V1_PANEL, // For apps v1 support in Ash; deprecate with v1 apps |
73 }; | 75 }; |
74 | 76 |
75 enum Frame { | 77 enum Frame { |
76 FRAME_CHROME, // Chrome-style window frame. | 78 FRAME_CHROME, // Chrome-style window frame. |
77 FRAME_NONE, // Frameless window. | 79 FRAME_NONE, // Frameless window. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 234 |
233 // Load the app's image, firing a load state change when loaded. | 235 // Load the app's image, firing a load state change when loaded. |
234 void UpdateExtensionAppIcon(); | 236 void UpdateExtensionAppIcon(); |
235 | 237 |
236 void OnImageLoaded(const gfx::Image& image); | 238 void OnImageLoaded(const gfx::Image& image); |
237 | 239 |
238 // extensions::ExtensionKeybindingRegistry::Delegate implementation. | 240 // extensions::ExtensionKeybindingRegistry::Delegate implementation. |
239 virtual extensions::ActiveTabPermissionGranter* | 241 virtual extensions::ActiveTabPermissionGranter* |
240 GetActiveTabPermissionGranter() OVERRIDE; | 242 GetActiveTabPermissionGranter() OVERRIDE; |
241 | 243 |
| 244 // WebContentsModalDialogManagerDelegate implementation. |
| 245 virtual void SetWebContentsBlocked(content::WebContents* web_contents, |
| 246 bool blocked) OVERRIDE; |
| 247 |
| 248 virtual WebContentsModalDialogHost* GetWebContentsModalDialogHost() OVERRIDE; |
| 249 |
242 // Callback from web_contents()->DownloadFavicon. | 250 // Callback from web_contents()->DownloadFavicon. |
243 void DidDownloadFavicon(int id, | 251 void DidDownloadFavicon(int id, |
244 const GURL& image_url, | 252 const GURL& image_url, |
245 int requested_size, | 253 int requested_size, |
246 const std::vector<SkBitmap>& bitmaps); | 254 const std::vector<SkBitmap>& bitmaps); |
247 | 255 |
248 Profile* profile_; // weak pointer - owned by ProfileManager. | 256 Profile* profile_; // weak pointer - owned by ProfileManager. |
249 // weak pointer - owned by ExtensionService. | 257 // weak pointer - owned by ExtensionService. |
250 const extensions::Extension* extension_; | 258 const extensions::Extension* extension_; |
251 | 259 |
(...skipping 14 matching lines...) Expand all Loading... |
266 | 274 |
267 scoped_ptr<NativeAppWindow> native_app_window_; | 275 scoped_ptr<NativeAppWindow> native_app_window_; |
268 scoped_ptr<ShellWindowContents> shell_window_contents_; | 276 scoped_ptr<ShellWindowContents> shell_window_contents_; |
269 | 277 |
270 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_; | 278 base::WeakPtrFactory<ShellWindow> image_loader_ptr_factory_; |
271 | 279 |
272 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 280 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
273 }; | 281 }; |
274 | 282 |
275 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 283 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
OLD | NEW |