OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/common/chrome_content_client.h" | 5 #include "chrome/common/chrome_content_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 const char kPDFPluginDescription[] = "Portable Document Format"; | 69 const char kPDFPluginDescription[] = "Portable Document Format"; |
70 const char kPDFPluginOutOfProcessMimeType[] = | 70 const char kPDFPluginOutOfProcessMimeType[] = |
71 "application/x-google-chrome-pdf"; | 71 "application/x-google-chrome-pdf"; |
72 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | | 72 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE | |
73 ppapi::PERMISSION_DEV; | 73 ppapi::PERMISSION_DEV; |
74 | 74 |
75 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface; | 75 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface; |
76 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module; | 76 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module; |
77 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module; | 77 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module; |
78 | 78 |
79 #if defined(ENABLE_REMOTING) | |
80 | |
81 content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface; | |
82 content::PepperPluginInfo::PPP_InitializeModuleFunc | |
83 g_remoting_initialize_module; | |
84 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_remoting_shutdown_module; | |
85 | |
86 #if defined(GOOGLE_CHROME_BUILD) | |
87 const char kRemotingViewerPluginName[] = "Chrome Remote Desktop Viewer"; | |
88 #else | |
89 const char kRemotingViewerPluginName[] = "Chromoting Viewer"; | |
90 #endif // defined(GOOGLE_CHROME_BUILD) | |
91 const char kRemotingViewerPluginDescription[] = | |
92 "This plugin allows you to securely access other computers that have been " | |
93 "shared with you. To use this plugin you must first install the " | |
94 "<a href=\"https://chrome.google.com/remotedesktop\">" | |
95 "Chrome Remote Desktop</a> webapp."; | |
96 // Use a consistent MIME-type regardless of branding. | |
97 const char kRemotingViewerPluginMimeType[] = | |
98 "application/vnd.chromium.remoting-viewer"; | |
99 const char kRemotingViewerPluginMimeExtension[] = ""; | |
100 const char kRemotingViewerPluginMimeDescription[] = ""; | |
101 const uint32 kRemotingViewerPluginPermissions = ppapi::PERMISSION_PRIVATE | | |
102 ppapi::PERMISSION_DEV; | |
103 #endif // defined(ENABLE_REMOTING) | |
104 | |
105 #if !defined(DISABLE_NACL) | 79 #if !defined(DISABLE_NACL) |
106 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface; | 80 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface; |
107 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module; | 81 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module; |
108 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module; | 82 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module; |
109 #endif | 83 #endif |
110 | 84 |
111 // Appends the known built-in plugins to the given vector. Some built-in | 85 // Appends the known built-in plugins to the given vector. Some built-in |
112 // plugins are "internal" which means they are compiled into the Chrome binary, | 86 // plugins are "internal" which means they are compiled into the Chrome binary, |
113 // and some are extra shared libraries distributed with the browser (these are | 87 // and some are extra shared libraries distributed with the browser (these are |
114 // not marked internal, aside from being automatically registered, they're just | 88 // not marked internal, aside from being automatically registered, they're just |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 171 |
198 widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); | 172 widevine_cdm.mime_types.push_back(widevine_cdm_mime_type); |
199 widevine_cdm.permissions = kWidevineCdmPluginPermissions; | 173 widevine_cdm.permissions = kWidevineCdmPluginPermissions; |
200 plugins->push_back(widevine_cdm); | 174 plugins->push_back(widevine_cdm); |
201 | 175 |
202 skip_widevine_cdm_file_check = true; | 176 skip_widevine_cdm_file_check = true; |
203 } | 177 } |
204 } | 178 } |
205 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && | 179 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && |
206 // !defined(WIDEVINE_CDM_IS_COMPONENT) | 180 // !defined(WIDEVINE_CDM_IS_COMPONENT) |
207 | |
208 // The Remoting Viewer plugin is built-in. | |
209 #if defined(ENABLE_REMOTING) | |
210 content::PepperPluginInfo info; | |
211 info.is_internal = true; | |
212 info.is_out_of_process = true; | |
213 info.name = kRemotingViewerPluginName; | |
214 info.description = kRemotingViewerPluginDescription; | |
215 info.path = base::FilePath::FromUTF8Unsafe( | |
216 ChromeContentClient::kRemotingViewerPluginPath); | |
217 content::WebPluginMimeType remoting_mime_type( | |
218 kRemotingViewerPluginMimeType, | |
219 kRemotingViewerPluginMimeExtension, | |
220 kRemotingViewerPluginMimeDescription); | |
221 info.mime_types.push_back(remoting_mime_type); | |
222 info.internal_entry_points.get_interface = g_remoting_get_interface; | |
223 info.internal_entry_points.initialize_module = g_remoting_initialize_module; | |
224 info.internal_entry_points.shutdown_module = g_remoting_shutdown_module; | |
225 info.permissions = kRemotingViewerPluginPermissions; | |
226 | |
227 plugins->push_back(info); | |
228 #endif | |
229 } | 181 } |
230 | 182 |
231 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, | 183 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, |
232 const std::string& version) { | 184 const std::string& version) { |
233 content::PepperPluginInfo plugin; | 185 content::PepperPluginInfo plugin; |
234 | 186 |
235 plugin.is_out_of_process = true; | 187 plugin.is_out_of_process = true; |
236 plugin.name = content::kFlashPluginName; | 188 plugin.name = content::kFlashPluginName; |
237 plugin.path = path; | 189 plugin.path = path; |
238 plugin.permissions = chrome::kPepperFlashPermissions; | 190 plugin.permissions = chrome::kPepperFlashPermissions; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 343 } |
392 | 344 |
393 std::string product = GetProduct(); | 345 std::string product = GetProduct(); |
394 #if defined(OS_ANDROID) | 346 #if defined(OS_ANDROID) |
395 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) | 347 if (command_line->HasSwitch(switches::kUseMobileUserAgent)) |
396 product += " Mobile"; | 348 product += " Mobile"; |
397 #endif | 349 #endif |
398 return content::BuildUserAgentFromProduct(product); | 350 return content::BuildUserAgentFromProduct(product); |
399 } | 351 } |
400 | 352 |
401 | |
402 #if defined(ENABLE_REMOTING) | |
403 | |
404 void ChromeContentClient::SetRemotingEntryFunctions( | |
405 content::PepperPluginInfo::GetInterfaceFunc get_interface, | |
406 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module, | |
407 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) { | |
408 g_remoting_get_interface = get_interface; | |
409 g_remoting_initialize_module = initialize_module; | |
410 g_remoting_shutdown_module = shutdown_module; | |
411 } | |
412 #endif | |
413 | |
414 #if !defined(DISABLE_NACL) | 353 #if !defined(DISABLE_NACL) |
415 void ChromeContentClient::SetNaClEntryFunctions( | 354 void ChromeContentClient::SetNaClEntryFunctions( |
416 content::PepperPluginInfo::GetInterfaceFunc get_interface, | 355 content::PepperPluginInfo::GetInterfaceFunc get_interface, |
417 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module, | 356 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module, |
418 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) { | 357 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) { |
419 g_nacl_get_interface = get_interface; | 358 g_nacl_get_interface = get_interface; |
420 g_nacl_initialize_module = initialize_module; | 359 g_nacl_initialize_module = initialize_module; |
421 g_nacl_shutdown_module = shutdown_module; | 360 g_nacl_shutdown_module = shutdown_module; |
422 } | 361 } |
423 #endif | 362 #endif |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 schemes->insert(content::kChromeUIScheme); | 492 schemes->insert(content::kChromeUIScheme); |
554 schemes->insert(extensions::kExtensionScheme); | 493 schemes->insert(extensions::kExtensionScheme); |
555 schemes->insert(extensions::kExtensionResourceScheme); | 494 schemes->insert(extensions::kExtensionResourceScheme); |
556 GetSecureOriginWhitelist(origins); | 495 GetSecureOriginWhitelist(origins); |
557 } | 496 } |
558 | 497 |
559 void ChromeContentClient::AddServiceWorkerSchemes( | 498 void ChromeContentClient::AddServiceWorkerSchemes( |
560 std::set<std::string>* schemes) { | 499 std::set<std::string>* schemes) { |
561 schemes->insert(extensions::kExtensionScheme); | 500 schemes->insert(extensions::kExtensionScheme); |
562 } | 501 } |
OLD | NEW |