1 // Copyright 2014 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 #include "extensions/shell/browser/shell_app_delegate.h"
7 #include "content/public/browser/web_contents.h"
8 #include "extensions/common/constants.h"
9 #include "extensions/shell/browser/media_capture_util.h"
11 namespace extensions
{
13 ShellAppDelegate::ShellAppDelegate() {
16 ShellAppDelegate::~ShellAppDelegate() {
19 void ShellAppDelegate::InitWebContents(content::WebContents
* web_contents
) {
22 void ShellAppDelegate::RenderViewCreated(
23 content::RenderViewHost
* render_view_host
) {
24 // The views implementation of AppWindow takes focus via SetInitialFocus()
25 // and views::WebView but app_shell is aura-only and must do it manually.
26 content::WebContents::FromRenderViewHost(render_view_host
)->Focus();
29 void ShellAppDelegate::ResizeWebContents(content::WebContents
* web_contents
,
30 const gfx::Size
& size
) {
34 content::WebContents
* ShellAppDelegate::OpenURLFromTab(
35 content::BrowserContext
* context
,
36 content::WebContents
* source
,
37 const content::OpenURLParams
& params
) {
42 void ShellAppDelegate::AddNewContents(content::BrowserContext
* context
,
43 content::WebContents
* new_contents
,
44 WindowOpenDisposition disposition
,
45 const gfx::Rect
& initial_rect
,
51 content::ColorChooser
* ShellAppDelegate::ShowColorChooser(
52 content::WebContents
* web_contents
,
53 SkColor initial_color
) {
58 void ShellAppDelegate::RunFileChooser(
59 content::WebContents
* tab
,
60 const content::FileChooserParams
& params
) {
64 void ShellAppDelegate::RequestMediaAccessPermission(
65 content::WebContents
* web_contents
,
66 const content::MediaStreamRequest
& request
,
67 const content::MediaResponseCallback
& callback
,
68 const extensions::Extension
* extension
) {
69 media_capture_util::GrantMediaStreamRequest(
70 web_contents
, request
, callback
, extension
);
73 bool ShellAppDelegate::CheckMediaAccessPermission(
74 content::WebContents
* web_contents
,
75 const GURL
& security_origin
,
76 content::MediaStreamType type
,
77 const Extension
* extension
) {
78 media_capture_util::VerifyMediaAccessPermission(type
, extension
);
82 int ShellAppDelegate::PreferredIconSize() {
83 return extension_misc::EXTENSION_ICON_SMALL
;
86 void ShellAppDelegate::SetWebContentsBlocked(
87 content::WebContents
* web_contents
,
92 bool ShellAppDelegate::IsWebContentsVisible(
93 content::WebContents
* web_contents
) {
97 void ShellAppDelegate::SetTerminatingCallback(const base::Closure
& callback
) {
98 // TODO(jamescook): Should app_shell continue to close the app window
99 // manually or should it use a browser termination callback like Chrome?
102 } // namespace extensions