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