OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "athena/extensions/chrome/athena_chrome_app_delegate.h" | |
6 | |
7 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | |
8 #include "chrome/browser/favicon/favicon_tab_helper.h" | |
9 #include "chrome/browser/file_select_helper.h" | |
10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | |
11 #include "chrome/browser/platform_util.h" | |
12 #include "chrome/browser/ui/browser_dialogs.h" | |
13 #include "chrome/common/extensions/chrome_extension_messages.h" | |
14 #include "content/public/browser/render_view_host.h" | |
15 #include "content/public/browser/web_contents.h" | |
16 | |
17 #if defined(ENABLE_PRINTING) | |
18 #if defined(ENABLE_PRINT_PREVIEW) | |
19 #include "chrome/browser/printing/print_preview_message_handler.h" | |
20 #include "chrome/browser/printing/print_view_manager.h" | |
21 #else | |
22 #include "chrome/browser/printing/print_view_manager_basic.h" | |
23 #endif // defined(ENABLE_PRINT_PREVIEW) | |
24 #endif // defined(ENABLE_PRINTING) | |
25 | |
26 namespace athena { | |
27 | |
28 AthenaChromeAppDelegate::AthenaChromeAppDelegate() { | |
29 } | |
30 | |
31 AthenaChromeAppDelegate::~AthenaChromeAppDelegate() { | |
32 } | |
33 | |
34 void AthenaChromeAppDelegate::InitWebContents( | |
35 content::WebContents* web_contents) { | |
36 FaviconTabHelper::CreateForWebContents(web_contents); | |
37 | |
38 #if defined(ENABLE_PRINTING) | |
39 #if defined(ENABLE_PRINT_PREVIEW) | |
40 printing::PrintViewManager::CreateForWebContents(web_contents); | |
41 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents); | |
42 #else | |
43 printing::PrintViewManagerBasic::CreateForWebContents(web_contents); | |
44 #endif // defined(ENABLE_PRINT_PREVIEW) | |
45 #endif // defined(ENABLE_PRINTING) | |
46 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | |
47 web_contents); | |
48 } | |
49 | |
50 content::ColorChooser* AthenaChromeAppDelegate::ShowColorChooser( | |
51 content::WebContents* web_contents, | |
52 SkColor initial_color) { | |
53 return chrome::ShowColorChooser(web_contents, initial_color); | |
54 } | |
55 | |
56 void AthenaChromeAppDelegate::RunFileChooser( | |
57 content::WebContents* tab, | |
58 const content::FileChooserParams& params) { | |
59 FileSelectHelper::RunFileChooser(tab, params); | |
60 } | |
61 | |
62 void AthenaChromeAppDelegate::RequestMediaAccessPermission( | |
63 content::WebContents* web_contents, | |
64 const content::MediaStreamRequest& request, | |
65 const content::MediaResponseCallback& callback, | |
66 const extensions::Extension* extension) { | |
67 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( | |
68 web_contents, request, callback, extension); | |
69 } | |
70 | |
71 bool AthenaChromeAppDelegate::CheckMediaAccessPermission( | |
72 content::WebContents* web_contents, | |
73 const GURL& security_origin, | |
74 content::MediaStreamType type, | |
75 const extensions::Extension* extension) { | |
76 return MediaCaptureDevicesDispatcher::GetInstance() | |
77 ->CheckMediaAccessPermission( | |
78 web_contents, security_origin, type, extension); | |
79 } | |
80 | |
81 void AthenaChromeAppDelegate::SetWebContentsBlocked( | |
82 content::WebContents* web_contents, | |
83 bool blocked) { | |
84 // RenderViewHost may be nullptr during shutdown. | |
85 content::RenderViewHost* host = web_contents->GetRenderViewHost(); | |
86 if (host) { | |
87 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized(host->GetRoutingID(), | |
88 blocked)); | |
89 } | |
90 } | |
91 | |
92 } // namespace athena | |
OLD | NEW |