OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_APPS_CHROME_APP_DELEGATE_H_ | 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_APP_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ | 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_APP_DELEGATE_H_ |
7 | 7 |
8 #include "base/callback.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "content/public/browser/notification_observer.h" | |
11 #include "content/public/browser/notification_registrar.h" | |
12 #include "extensions/browser/app_window/app_delegate.h" | 8 #include "extensions/browser/app_window/app_delegate.h" |
13 #include "ui/base/window_open_disposition.h" | |
14 #include "ui/gfx/rect.h" | |
15 | 9 |
16 namespace content { | 10 namespace extensions { |
17 class BrowserContext; | |
18 class WebContents; | |
19 } | |
20 | 11 |
21 class ChromeAppDelegate : public extensions::AppDelegate, | 12 // app_shell's AppDelegate implementation. |
22 public content::NotificationObserver { | 13 class ShellAppDelegate : public AppDelegate { |
23 public: | 14 public: |
24 ChromeAppDelegate(); | 15 ShellAppDelegate(); |
25 virtual ~ChromeAppDelegate(); | 16 virtual ~ShellAppDelegate(); |
26 | 17 |
27 static void DisableExternalOpenForTesting(); | 18 // AppDelegate overrides: |
28 | |
29 private: | |
30 class NewWindowContentsDelegate; | |
31 | |
32 // extensions::AppDelegate: | |
33 virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE; | 19 virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE; |
34 virtual void ResizeWebContents(content::WebContents* web_contents, | 20 virtual void ResizeWebContents(content::WebContents* web_contents, |
35 const gfx::Size& size) OVERRIDE; | 21 const gfx::Size& size) OVERRIDE; |
36 virtual content::WebContents* OpenURLFromTab( | 22 virtual content::WebContents* OpenURLFromTab( |
37 content::BrowserContext* context, | 23 content::BrowserContext* context, |
38 content::WebContents* source, | 24 content::WebContents* source, |
39 const content::OpenURLParams& params) OVERRIDE; | 25 const content::OpenURLParams& params) OVERRIDE; |
40 virtual void AddNewContents(content::BrowserContext* context, | 26 virtual void AddNewContents(content::BrowserContext* context, |
41 content::WebContents* new_contents, | 27 content::WebContents* new_contents, |
42 WindowOpenDisposition disposition, | 28 WindowOpenDisposition disposition, |
43 const gfx::Rect& initial_pos, | 29 const gfx::Rect& initial_pos, |
44 bool user_gesture, | 30 bool user_gesture, |
45 bool* was_blocked) OVERRIDE; | 31 bool* was_blocked) OVERRIDE; |
46 virtual content::ColorChooser* ShowColorChooser( | 32 virtual content::ColorChooser* ShowColorChooser( |
47 content::WebContents* web_contents, | 33 content::WebContents* web_contents, |
48 SkColor initial_color) OVERRIDE; | 34 SkColor initial_color) OVERRIDE; |
49 virtual void RunFileChooser( | 35 virtual void RunFileChooser( |
50 content::WebContents* tab, | 36 content::WebContents* tab, |
51 const content::FileChooserParams& params) OVERRIDE; | 37 const content::FileChooserParams& params) OVERRIDE; |
52 virtual void RequestMediaAccessPermission( | 38 virtual void RequestMediaAccessPermission( |
53 content::WebContents* web_contents, | 39 content::WebContents* web_contents, |
54 const content::MediaStreamRequest& request, | 40 const content::MediaStreamRequest& request, |
55 const content::MediaResponseCallback& callback, | 41 const content::MediaResponseCallback& callback, |
56 const extensions::Extension* extension) OVERRIDE; | 42 const Extension* extension) OVERRIDE; |
57 virtual int PreferredIconSize() OVERRIDE; | 43 virtual int PreferredIconSize() OVERRIDE; |
58 virtual gfx::ImageSkia GetAppDefaultIcon() OVERRIDE; | 44 virtual gfx::ImageSkia GetAppDefaultIcon() OVERRIDE; |
59 virtual void SetWebContentsBlocked(content::WebContents* web_contents, | 45 virtual void SetWebContentsBlocked(content::WebContents* web_contents, |
60 bool blocked) OVERRIDE; | 46 bool blocked) OVERRIDE; |
61 virtual bool IsWebContentsVisible( | 47 virtual bool IsWebContentsVisible( |
62 content::WebContents* web_contents) OVERRIDE; | 48 content::WebContents* web_contents) OVERRIDE; |
63 virtual void SetTerminatingCallback(const base::Closure& callback) OVERRIDE; | 49 virtual void SetTerminatingCallback(const base::Closure& callback) OVERRIDE; |
64 | 50 |
65 // content::NotificationObserver: | 51 private: |
66 virtual void Observe(int type, | 52 DISALLOW_COPY_AND_ASSIGN(ShellAppDelegate); |
67 const content::NotificationSource& source, | |
68 const content::NotificationDetails& details) OVERRIDE; | |
69 | |
70 scoped_ptr<NewWindowContentsDelegate> new_window_contents_delegate_; | |
71 base::Closure terminating_callback_; | |
72 content::NotificationRegistrar registrar_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(ChromeAppDelegate); | |
75 }; | 53 }; |
76 | 54 |
77 #endif // CHROME_BROWSER_UI_APPS_CHROME_APP_DELEGATE_H_ | 55 } // namespace extensions |
| 56 |
| 57 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_APP_DELEGATE_H_ |
OLD | NEW |