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