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