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/shell_window.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_contents_delegate.h"
13 #include "ui/base/window_open_disposition.h"
14 #include "ui/gfx/rect.h"
16 class ShellWindowLinkDelegate
: public content::WebContentsDelegate
{
18 ShellWindowLinkDelegate();
19 virtual ~ShellWindowLinkDelegate();
22 virtual content::WebContents
* OpenURLFromTab(
23 content::WebContents
* source
,
24 const content::OpenURLParams
& params
) OVERRIDE
;
26 DISALLOW_COPY_AND_ASSIGN(ShellWindowLinkDelegate
);
29 class ChromeShellWindowDelegate
: public apps::ShellWindow::Delegate
{
31 ChromeShellWindowDelegate();
32 virtual ~ChromeShellWindowDelegate();
34 static void DisableExternalOpenForTesting();
37 // apps::ShellWindow::Delegate:
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
;
42 virtual content::WebContents
* OpenURLFromTab(
44 content::WebContents
* source
,
45 const content::OpenURLParams
& params
) OVERRIDE
;
46 virtual void AddNewContents(Profile
* profile
,
47 content::WebContents
* new_contents
,
48 WindowOpenDisposition disposition
,
49 const gfx::Rect
& initial_pos
,
51 bool* was_blocked
) OVERRIDE
;
52 virtual content::ColorChooser
* ShowColorChooser(
53 content::WebContents
* web_contents
,
54 SkColor initial_color
) OVERRIDE
;
55 virtual void RunFileChooser(
56 content::WebContents
* tab
,
57 const content::FileChooserParams
& params
) OVERRIDE
;
58 virtual void RequestMediaAccessPermission(
59 content::WebContents
* web_contents
,
60 const content::MediaStreamRequest
& request
,
61 const content::MediaResponseCallback
& callback
,
62 const extensions::Extension
* extension
) OVERRIDE
;
63 virtual int PreferredIconSize() OVERRIDE
;
64 virtual void SetWebContentsBlocked(content::WebContents
* web_contents
,
65 bool blocked
) OVERRIDE
;
66 virtual bool IsWebContentsVisible(
67 content::WebContents
* web_contents
) OVERRIDE
;
69 // Implemented in platform specific code.
70 static apps::NativeAppWindow
* CreateNativeAppWindowImpl(
71 apps::ShellWindow
* window
,
72 const apps::ShellWindow::CreateParams
& params
);
74 scoped_ptr
<ShellWindowLinkDelegate
> shell_window_link_delegate_
;
76 DISALLOW_COPY_AND_ASSIGN(ChromeShellWindowDelegate
);
79 #endif // CHROME_BROWSER_UI_APPS_CHROME_SHELL_WINDOW_DELEGATE_H_