OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SHELL_WINDOW_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_ |
7 | 7 |
8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "content/public/browser/web_contents_delegate.h" | 12 #include "content/public/browser/web_contents_delegate.h" |
13 #include "ui/base/window_open_disposition.h" | 13 #include "ui/base/window_open_disposition.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 | 15 |
16 namespace chrome { | |
17 | |
18 class ShellWindowLinkDelegate : public content::WebContentsDelegate { | 16 class ShellWindowLinkDelegate : public content::WebContentsDelegate { |
19 public: | 17 public: |
20 ShellWindowLinkDelegate(); | 18 ShellWindowLinkDelegate(); |
21 virtual ~ShellWindowLinkDelegate(); | 19 virtual ~ShellWindowLinkDelegate(); |
22 | 20 |
23 private: | 21 private: |
24 virtual content::WebContents* OpenURLFromTab( | 22 virtual content::WebContents* OpenURLFromTab( |
25 content::WebContents* source, | 23 content::WebContents* source, |
26 const content::OpenURLParams& params) OVERRIDE; | 24 const content::OpenURLParams& params) OVERRIDE; |
27 | 25 |
28 DISALLOW_COPY_AND_ASSIGN(ShellWindowLinkDelegate); | 26 DISALLOW_COPY_AND_ASSIGN(ShellWindowLinkDelegate); |
29 }; | 27 }; |
30 | 28 |
31 class ChromeShellWindowDelegate : public apps::ShellWindow::Delegate { | 29 class ChromeShellWindowDelegate : public apps::ShellWindow::Delegate { |
32 public: | 30 public: |
33 ChromeShellWindowDelegate(); | 31 ChromeShellWindowDelegate(); |
34 virtual ~ChromeShellWindowDelegate(); | 32 virtual ~ChromeShellWindowDelegate(); |
35 | 33 |
36 static void DisableExternalOpenForTesting(); | 34 static void DisableExternalOpenForTesting(); |
37 | 35 |
38 private: | 36 private: |
39 // apps::ShellWindow::Delegate: | 37 // apps::ShellWindow::Delegate: |
40 virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE; | 38 virtual void InitWebContents(content::WebContents* web_contents) OVERRIDE; |
| 39 virtual apps::NativeAppWindow* CreateNativeAppWindow( |
| 40 apps::ShellWindow* window, |
| 41 const apps::ShellWindow::CreateParams& params) OVERRIDE; |
41 virtual content::WebContents* OpenURLFromTab( | 42 virtual content::WebContents* OpenURLFromTab( |
42 Profile* profile, | 43 Profile* profile, |
43 content::WebContents* source, | 44 content::WebContents* source, |
44 const content::OpenURLParams& params) OVERRIDE; | 45 const content::OpenURLParams& params) OVERRIDE; |
45 virtual void AddNewContents(Profile* profile, | 46 virtual void AddNewContents(Profile* profile, |
46 content::WebContents* new_contents, | 47 content::WebContents* new_contents, |
47 WindowOpenDisposition disposition, | 48 WindowOpenDisposition disposition, |
48 const gfx::Rect& initial_pos, | 49 const gfx::Rect& initial_pos, |
49 bool user_gesture, | 50 bool user_gesture, |
50 bool* was_blocked) OVERRIDE; | 51 bool* was_blocked) OVERRIDE; |
51 virtual content::ColorChooser* ShowColorChooser( | 52 virtual content::ColorChooser* ShowColorChooser( |
52 content::WebContents* web_contents, | 53 content::WebContents* web_contents, |
53 SkColor initial_color) OVERRIDE; | 54 SkColor initial_color) OVERRIDE; |
54 virtual void RunFileChooser( | 55 virtual void RunFileChooser( |
55 content::WebContents* tab, | 56 content::WebContents* tab, |
56 const content::FileChooserParams& params) OVERRIDE; | 57 const content::FileChooserParams& params) OVERRIDE; |
57 virtual void RequestMediaAccessPermission( | 58 virtual void RequestMediaAccessPermission( |
58 content::WebContents* web_contents, | 59 content::WebContents* web_contents, |
59 const content::MediaStreamRequest& request, | 60 const content::MediaStreamRequest& request, |
60 const content::MediaResponseCallback& callback, | 61 const content::MediaResponseCallback& callback, |
61 const extensions::Extension* extension) OVERRIDE; | 62 const extensions::Extension* extension) OVERRIDE; |
62 virtual int PreferredIconSize() OVERRIDE; | 63 virtual int PreferredIconSize() OVERRIDE; |
63 virtual void SetWebContentsBlocked(content::WebContents* web_contents, | 64 virtual void SetWebContentsBlocked(content::WebContents* web_contents, |
64 bool blocked) OVERRIDE; | 65 bool blocked) OVERRIDE; |
65 virtual bool IsWebContentsVisible( | 66 virtual bool IsWebContentsVisible( |
66 content::WebContents* web_contents) OVERRIDE; | 67 content::WebContents* web_contents) OVERRIDE; |
67 | 68 |
| 69 // Implemented in platform specific code. |
| 70 static apps::NativeAppWindow* CreateNativeAppWindowImpl( |
| 71 apps::ShellWindow* window, |
| 72 const apps::ShellWindow::CreateParams& params); |
| 73 |
68 scoped_ptr<ShellWindowLinkDelegate> shell_window_link_delegate_; | 74 scoped_ptr<ShellWindowLinkDelegate> shell_window_link_delegate_; |
69 | 75 |
70 DISALLOW_COPY_AND_ASSIGN(ChromeShellWindowDelegate); | 76 DISALLOW_COPY_AND_ASSIGN(ChromeShellWindowDelegate); |
71 }; | 77 }; |
72 | 78 |
73 } // namespace chrome | |
74 | |
75 #endif // CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_ | 79 #endif // CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_ |
OLD | NEW |