Supervised user import: Listen for profile creation/deletion
[chromium-blink-merge.git] / chrome / common / chrome_content_client.cc
blob854f7e5a2cd9e276e75aa7c8dc920dafeb5a5a5c
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
3 // found in the LICENSE file.
5 #include "chrome/common/chrome_content_client.h"
7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h"
9 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h"
11 #include "base/path_service.h"
12 #include "base/strings/string16.h"
13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h"
18 #include "build/build_config.h"
19 #include "chrome/common/child_process_logging.h"
20 #include "chrome/common/chrome_constants.h"
21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/chrome_version_info.h"
24 #include "chrome/common/crash_keys.h"
25 #include "chrome/common/pepper_flash.h"
26 #include "chrome/common/render_messages.h"
27 #include "chrome/common/url_constants.h"
28 #include "chrome/grit/common_resources.h"
29 #include "components/dom_distiller/core/url_constants.h"
30 #include "content/public/common/content_constants.h"
31 #include "content/public/common/content_switches.h"
32 #include "content/public/common/url_constants.h"
33 #include "content/public/common/user_agent.h"
34 #include "extensions/common/constants.h"
35 #include "gpu/config/gpu_info.h"
36 #include "net/http/http_util.h"
37 #include "ui/base/l10n/l10n_util.h"
38 #include "ui/base/layout.h"
39 #include "ui/base/resource/resource_bundle.h"
41 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
43 #if defined(OS_WIN)
44 #include "base/win/registry.h"
45 #include "base/win/windows_version.h"
46 #elif defined(OS_MACOSX)
47 #include "components/nacl/common/nacl_sandbox_type_mac.h"
48 #endif
50 #if !defined(DISABLE_NACL)
51 #include "components/nacl/common/nacl_constants.h"
52 #include "components/nacl/common/nacl_process_type.h"
53 #endif
55 #if defined(ENABLE_PLUGINS)
56 #include "chrome/common/pepper_flash.h"
57 #include "content/public/common/pepper_plugin_info.h"
58 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
59 #include "ppapi/shared_impl/ppapi_permissions.h"
60 #endif
62 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
63 !defined(WIDEVINE_CDM_IS_COMPONENT)
64 #include "chrome/common/widevine_cdm_constants.h"
65 #endif
67 namespace {
69 #if defined(ENABLE_PLUGINS)
70 const char kPDFPluginExtension[] = "pdf";
71 const char kPDFPluginDescription[] = "Portable Document Format";
72 const char kPDFPluginOutOfProcessMimeType[] =
73 "application/x-google-chrome-pdf";
74 const uint32 kPDFPluginPermissions = ppapi::PERMISSION_PRIVATE |
75 ppapi::PERMISSION_DEV;
77 content::PepperPluginInfo::GetInterfaceFunc g_pdf_get_interface;
78 content::PepperPluginInfo::PPP_InitializeModuleFunc g_pdf_initialize_module;
79 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_pdf_shutdown_module;
81 #if defined(ENABLE_REMOTING)
83 content::PepperPluginInfo::GetInterfaceFunc g_remoting_get_interface;
84 content::PepperPluginInfo::PPP_InitializeModuleFunc
85 g_remoting_initialize_module;
86 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_remoting_shutdown_module;
88 #if defined(GOOGLE_CHROME_BUILD)
89 const char kRemotingViewerPluginName[] = "Chrome Remote Desktop Viewer";
90 #else
91 const char kRemotingViewerPluginName[] = "Chromoting Viewer";
92 #endif // defined(GOOGLE_CHROME_BUILD)
93 const char kRemotingViewerPluginDescription[] =
94 "This plugin allows you to securely access other computers that have been "
95 "shared with you. To use this plugin you must first install the "
96 "<a href=\"https://chrome.google.com/remotedesktop\">"
97 "Chrome Remote Desktop</a> webapp.";
98 // Use a consistent MIME-type regardless of branding.
99 const char kRemotingViewerPluginMimeType[] =
100 "application/vnd.chromium.remoting-viewer";
101 const char kRemotingViewerPluginMimeExtension[] = "";
102 const char kRemotingViewerPluginMimeDescription[] = "";
103 const uint32 kRemotingViewerPluginPermissions = ppapi::PERMISSION_PRIVATE |
104 ppapi::PERMISSION_DEV;
105 #endif // defined(ENABLE_REMOTING)
107 #if !defined(DISABLE_NACL)
108 content::PepperPluginInfo::GetInterfaceFunc g_nacl_get_interface;
109 content::PepperPluginInfo::PPP_InitializeModuleFunc g_nacl_initialize_module;
110 content::PepperPluginInfo::PPP_ShutdownModuleFunc g_nacl_shutdown_module;
111 #endif
113 // Appends the known built-in plugins to the given vector. Some built-in
114 // plugins are "internal" which means they are compiled into the Chrome binary,
115 // and some are extra shared libraries distributed with the browser (these are
116 // not marked internal, aside from being automatically registered, they're just
117 // regular plugins).
118 void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
119 content::PepperPluginInfo pdf_info;
120 pdf_info.is_internal = true;
121 pdf_info.is_out_of_process = true;
122 pdf_info.name = ChromeContentClient::kPDFPluginName;
123 pdf_info.description = kPDFPluginDescription;
124 pdf_info.path = base::FilePath::FromUTF8Unsafe(
125 ChromeContentClient::kPDFPluginPath);
126 content::WebPluginMimeType pdf_mime_type(
127 kPDFPluginOutOfProcessMimeType,
128 kPDFPluginExtension,
129 kPDFPluginDescription);
130 pdf_info.mime_types.push_back(pdf_mime_type);
131 pdf_info.internal_entry_points.get_interface = g_pdf_get_interface;
132 pdf_info.internal_entry_points.initialize_module = g_pdf_initialize_module;
133 pdf_info.internal_entry_points.shutdown_module = g_pdf_shutdown_module;
134 pdf_info.permissions = kPDFPluginPermissions;
135 plugins->push_back(pdf_info);
137 base::FilePath path;
139 #if !defined(DISABLE_NACL)
140 // Handle Native Client just like the PDF plugin. This means that it is
141 // enabled by default for the non-portable case. This allows apps installed
142 // from the Chrome Web Store to use NaCl even if the command line switch
143 // isn't set. For other uses of NaCl we check for the command line switch.
144 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) {
145 content::PepperPluginInfo nacl;
146 // The nacl plugin is now built into the Chromium binary.
147 nacl.is_internal = true;
148 nacl.path = path;
149 nacl.name = nacl::kNaClPluginName;
150 content::WebPluginMimeType nacl_mime_type(nacl::kNaClPluginMimeType,
151 nacl::kNaClPluginExtension,
152 nacl::kNaClPluginDescription);
153 nacl.mime_types.push_back(nacl_mime_type);
154 content::WebPluginMimeType pnacl_mime_type(nacl::kPnaclPluginMimeType,
155 nacl::kPnaclPluginExtension,
156 nacl::kPnaclPluginDescription);
157 nacl.mime_types.push_back(pnacl_mime_type);
158 nacl.internal_entry_points.get_interface = g_nacl_get_interface;
159 nacl.internal_entry_points.initialize_module = g_nacl_initialize_module;
160 nacl.internal_entry_points.shutdown_module = g_nacl_shutdown_module;
161 nacl.permissions = ppapi::PERMISSION_PRIVATE | ppapi::PERMISSION_DEV;
162 plugins->push_back(nacl);
164 #endif // !defined(DISABLE_NACL)
166 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) && \
167 !defined(WIDEVINE_CDM_IS_COMPONENT)
168 static bool skip_widevine_cdm_file_check = false;
169 if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) {
170 if (skip_widevine_cdm_file_check || base::PathExists(path)) {
171 content::PepperPluginInfo widevine_cdm;
172 widevine_cdm.is_out_of_process = true;
173 widevine_cdm.path = path;
174 widevine_cdm.name = kWidevineCdmDisplayName;
175 widevine_cdm.description = kWidevineCdmDescription +
176 std::string(" (version: ") +
177 WIDEVINE_CDM_VERSION_STRING + ")";
178 widevine_cdm.version = WIDEVINE_CDM_VERSION_STRING;
179 content::WebPluginMimeType widevine_cdm_mime_type(
180 kWidevineCdmPluginMimeType,
181 kWidevineCdmPluginExtension,
182 kWidevineCdmPluginMimeTypeDescription);
184 // Add the supported codecs as if they came from the component manifest.
185 std::vector<std::string> codecs;
186 codecs.push_back(kCdmSupportedCodecVorbis);
187 codecs.push_back(kCdmSupportedCodecVp8);
188 codecs.push_back(kCdmSupportedCodecVp9);
189 #if defined(USE_PROPRIETARY_CODECS)
190 codecs.push_back(kCdmSupportedCodecAac);
191 codecs.push_back(kCdmSupportedCodecAvc1);
192 #endif // defined(USE_PROPRIETARY_CODECS)
193 std::string codec_string =
194 JoinString(codecs, kCdmSupportedCodecsValueDelimiter);
195 widevine_cdm_mime_type.additional_param_names.push_back(
196 base::ASCIIToUTF16(kCdmSupportedCodecsParamName));
197 widevine_cdm_mime_type.additional_param_values.push_back(
198 base::ASCIIToUTF16(codec_string));
200 widevine_cdm.mime_types.push_back(widevine_cdm_mime_type);
201 widevine_cdm.permissions = kWidevineCdmPluginPermissions;
202 plugins->push_back(widevine_cdm);
204 skip_widevine_cdm_file_check = true;
207 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) &&
208 // !defined(WIDEVINE_CDM_IS_COMPONENT)
210 // The Remoting Viewer plugin is built-in.
211 #if defined(ENABLE_REMOTING)
212 content::PepperPluginInfo info;
213 info.is_internal = true;
214 info.is_out_of_process = true;
215 info.name = kRemotingViewerPluginName;
216 info.description = kRemotingViewerPluginDescription;
217 info.path = base::FilePath::FromUTF8Unsafe(
218 ChromeContentClient::kRemotingViewerPluginPath);
219 content::WebPluginMimeType remoting_mime_type(
220 kRemotingViewerPluginMimeType,
221 kRemotingViewerPluginMimeExtension,
222 kRemotingViewerPluginMimeDescription);
223 info.mime_types.push_back(remoting_mime_type);
224 info.internal_entry_points.get_interface = g_remoting_get_interface;
225 info.internal_entry_points.initialize_module = g_remoting_initialize_module;
226 info.internal_entry_points.shutdown_module = g_remoting_shutdown_module;
227 info.permissions = kRemotingViewerPluginPermissions;
229 plugins->push_back(info);
230 #endif
233 content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path,
234 const std::string& version) {
235 content::PepperPluginInfo plugin;
237 plugin.is_out_of_process = true;
238 plugin.name = content::kFlashPluginName;
239 plugin.path = path;
240 plugin.permissions = chrome::kPepperFlashPermissions;
242 std::vector<std::string> flash_version_numbers;
243 base::SplitString(version, '.', &flash_version_numbers);
244 if (flash_version_numbers.size() < 1)
245 flash_version_numbers.push_back("11");
246 // |SplitString()| puts in an empty string given an empty string. :(
247 else if (flash_version_numbers[0].empty())
248 flash_version_numbers[0] = "11";
249 if (flash_version_numbers.size() < 2)
250 flash_version_numbers.push_back("2");
251 if (flash_version_numbers.size() < 3)
252 flash_version_numbers.push_back("999");
253 if (flash_version_numbers.size() < 4)
254 flash_version_numbers.push_back("999");
255 // E.g., "Shockwave Flash 10.2 r154":
256 plugin.description = plugin.name + " " + flash_version_numbers[0] + "." +
257 flash_version_numbers[1] + " r" + flash_version_numbers[2];
258 plugin.version = JoinString(flash_version_numbers, '.');
259 content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType,
260 content::kFlashPluginSwfExtension,
261 content::kFlashPluginSwfDescription);
262 plugin.mime_types.push_back(swf_mime_type);
263 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType,
264 content::kFlashPluginSplExtension,
265 content::kFlashPluginSplDescription);
266 plugin.mime_types.push_back(spl_mime_type);
268 return plugin;
271 void AddPepperFlashFromCommandLine(
272 std::vector<content::PepperPluginInfo>* plugins) {
273 const base::CommandLine::StringType flash_path =
274 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
275 switches::kPpapiFlashPath);
276 if (flash_path.empty())
277 return;
279 // Also get the version from the command-line. Should be something like 11.2
280 // or 11.2.123.45.
281 std::string flash_version =
282 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
283 switches::kPpapiFlashVersion);
285 plugins->push_back(
286 CreatePepperFlashInfo(base::FilePath(flash_path), flash_version));
289 bool GetBundledPepperFlash(content::PepperPluginInfo* plugin) {
290 #if defined(FLAPPER_AVAILABLE)
291 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
293 // Ignore bundled Pepper Flash if there is Pepper Flash specified from the
294 // command-line.
295 if (command_line->HasSwitch(switches::kPpapiFlashPath))
296 return false;
298 bool force_disable =
299 command_line->HasSwitch(switches::kDisableBundledPpapiFlash);
300 if (force_disable)
301 return false;
303 base::FilePath flash_path;
304 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path))
305 return false;
307 *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING);
308 return true;
309 #else
310 return false;
311 #endif // FLAPPER_AVAILABLE
314 #if defined(OS_WIN)
315 const char kPepperFlashDLLBaseName[] =
316 #if defined(ARCH_CPU_X86)
317 "pepflashplayer32_";
318 #elif defined(ARCH_CPU_X86_64)
319 "pepflashplayer64_";
320 #else
321 #error Unsupported Windows CPU architecture.
322 #endif // defined(ARCH_CPU_X86)
323 #endif // defined(OS_WIN)
325 bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
326 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
327 #if defined(FLAPPER_AVAILABLE)
328 // If flapper is available, only try system plugin if
329 // --disable-bundled-ppapi-flash is specified.
330 if (!command_line->HasSwitch(switches::kDisableBundledPpapiFlash))
331 return false;
332 #endif // defined(FLAPPER_AVAILABLE)
334 // Do not try and find System Pepper Flash if there is a specific path on
335 // the commmand-line.
336 if (command_line->HasSwitch(switches::kPpapiFlashPath))
337 return false;
339 base::FilePath flash_path;
340 if (!PathService::Get(chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN, &flash_path))
341 return false;
343 if (!base::PathExists(flash_path))
344 return false;
346 base::FilePath manifest_path(flash_path.AppendASCII("manifest.json"));
348 std::string manifest_data;
349 if (!base::ReadFileToString(manifest_path, &manifest_data))
350 return false;
351 scoped_ptr<base::Value> manifest_value(
352 base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS));
353 if (!manifest_value.get())
354 return false;
355 base::DictionaryValue* manifest = NULL;
356 if (!manifest_value->GetAsDictionary(&manifest))
357 return false;
359 Version version;
360 if (!chrome::CheckPepperFlashManifest(*manifest, &version))
361 return false;
363 #if defined(OS_WIN)
364 // PepperFlash DLLs on Windows look like basename_v_x_y_z.dll.
365 std::string filename(kPepperFlashDLLBaseName);
366 filename.append(version.GetString());
367 base::ReplaceChars(filename, ".", "_", &filename);
368 filename.append(".dll");
370 base::FilePath path(flash_path.Append(base::ASCIIToUTF16(filename)));
371 #else
372 // PepperFlash on OS X is called PepperFlashPlayer.plugin
373 base::FilePath path(flash_path.Append(chrome::kPepperFlashPluginFilename));
374 #endif
376 if (!base::PathExists(path))
377 return false;
379 *plugin = CreatePepperFlashInfo(path, version.GetString());
380 return true;
382 #endif // defined(ENABLE_PLUGINS)
384 std::string GetProduct() {
385 chrome::VersionInfo version_info;
386 return version_info.ProductNameAndVersionForUserAgent();
389 } // namespace
391 std::string GetUserAgent() {
392 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
393 if (command_line->HasSwitch(switches::kUserAgent)) {
394 std::string ua = command_line->GetSwitchValueASCII(switches::kUserAgent);
395 if (net::HttpUtil::IsValidHeaderValue(ua))
396 return ua;
397 LOG(WARNING) << "Ignored invalid value for flag --" << switches::kUserAgent;
400 std::string product = GetProduct();
401 #if defined(OS_ANDROID)
402 if (command_line->HasSwitch(switches::kUseMobileUserAgent))
403 product += " Mobile";
404 #endif
405 return content::BuildUserAgentFromProduct(product);
409 #if defined(ENABLE_REMOTING)
411 void ChromeContentClient::SetRemotingEntryFunctions(
412 content::PepperPluginInfo::GetInterfaceFunc get_interface,
413 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
414 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) {
415 g_remoting_get_interface = get_interface;
416 g_remoting_initialize_module = initialize_module;
417 g_remoting_shutdown_module = shutdown_module;
419 #endif
421 #if !defined(DISABLE_NACL)
422 void ChromeContentClient::SetNaClEntryFunctions(
423 content::PepperPluginInfo::GetInterfaceFunc get_interface,
424 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
425 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) {
426 g_nacl_get_interface = get_interface;
427 g_nacl_initialize_module = initialize_module;
428 g_nacl_shutdown_module = shutdown_module;
430 #endif
432 #if defined(ENABLE_PLUGINS)
433 void ChromeContentClient::SetPDFEntryFunctions(
434 content::PepperPluginInfo::GetInterfaceFunc get_interface,
435 content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module,
436 content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) {
437 g_pdf_get_interface = get_interface;
438 g_pdf_initialize_module = initialize_module;
439 g_pdf_shutdown_module = shutdown_module;
441 #endif
443 void ChromeContentClient::SetActiveURL(const GURL& url) {
444 base::debug::SetCrashKeyValue(crash_keys::kActiveURL,
445 url.possibly_invalid_spec());
448 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) {
449 #if !defined(OS_ANDROID)
450 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID,
451 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id));
452 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID,
453 base::StringPrintf("0x%04x", gpu_info.gpu.device_id));
454 #endif
455 base::debug::SetCrashKeyValue(crash_keys::kGPUDriverVersion,
456 gpu_info.driver_version);
457 base::debug::SetCrashKeyValue(crash_keys::kGPUPixelShaderVersion,
458 gpu_info.pixel_shader_version);
459 base::debug::SetCrashKeyValue(crash_keys::kGPUVertexShaderVersion,
460 gpu_info.vertex_shader_version);
461 #if defined(OS_MACOSX)
462 base::debug::SetCrashKeyValue(crash_keys::kGPUGLVersion, gpu_info.gl_version);
463 #elif defined(OS_POSIX)
464 base::debug::SetCrashKeyValue(crash_keys::kGPUVendor, gpu_info.gl_vendor);
465 base::debug::SetCrashKeyValue(crash_keys::kGPURenderer, gpu_info.gl_renderer);
466 #endif
469 void ChromeContentClient::AddPepperPlugins(
470 std::vector<content::PepperPluginInfo>* plugins) {
471 #if defined(ENABLE_PLUGINS)
472 ComputeBuiltInPlugins(plugins);
473 AddPepperFlashFromCommandLine(plugins);
475 content::PepperPluginInfo plugin;
476 if (GetBundledPepperFlash(&plugin))
477 plugins->push_back(plugin);
478 if (GetSystemPepperFlash(&plugin))
479 plugins->push_back(plugin);
480 #endif
483 void ChromeContentClient::AddAdditionalSchemes(
484 std::vector<std::string>* standard_schemes,
485 std::vector<std::string>* savable_schemes) {
486 standard_schemes->push_back(extensions::kExtensionScheme);
487 savable_schemes->push_back(extensions::kExtensionScheme);
488 standard_schemes->push_back(chrome::kChromeNativeScheme);
489 standard_schemes->push_back(extensions::kExtensionResourceScheme);
490 savable_schemes->push_back(extensions::kExtensionResourceScheme);
491 standard_schemes->push_back(chrome::kChromeSearchScheme);
492 savable_schemes->push_back(chrome::kChromeSearchScheme);
493 standard_schemes->push_back(dom_distiller::kDomDistillerScheme);
494 savable_schemes->push_back(dom_distiller::kDomDistillerScheme);
495 #if defined(OS_CHROMEOS)
496 standard_schemes->push_back(chrome::kCrosScheme);
497 #endif
500 std::string ChromeContentClient::GetProduct() const {
501 return ::GetProduct();
504 std::string ChromeContentClient::GetUserAgent() const {
505 return ::GetUserAgent();
508 base::string16 ChromeContentClient::GetLocalizedString(int message_id) const {
509 return l10n_util::GetStringUTF16(message_id);
512 base::StringPiece ChromeContentClient::GetDataResource(
513 int resource_id,
514 ui::ScaleFactor scale_factor) const {
515 return ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
516 resource_id, scale_factor);
519 base::RefCountedStaticMemory* ChromeContentClient::GetDataResourceBytes(
520 int resource_id) const {
521 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
524 gfx::Image& ChromeContentClient::GetNativeImageNamed(int resource_id) const {
525 return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
528 std::string ChromeContentClient::GetProcessTypeNameInEnglish(int type) {
529 #if !defined(DISABLE_NACL)
530 switch (type) {
531 case PROCESS_TYPE_NACL_LOADER:
532 return "Native Client module";
533 case PROCESS_TYPE_NACL_BROKER:
534 return "Native Client broker";
536 #endif
538 NOTREACHED() << "Unknown child process type!";
539 return "Unknown";
542 #if defined(OS_MACOSX) && !defined(OS_IOS)
543 bool ChromeContentClient::GetSandboxProfileForSandboxType(
544 int sandbox_type,
545 int* sandbox_profile_resource_id) const {
546 DCHECK(sandbox_profile_resource_id);
547 if (sandbox_type == NACL_SANDBOX_TYPE_NACL_LOADER) {
548 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE;
549 return true;
551 return false;
553 #endif
555 void ChromeContentClient::AddSecureSchemesAndOrigins(
556 std::set<std::string>* schemes,
557 std::set<GURL>* origins) {
558 schemes->insert(content::kChromeUIScheme);
559 schemes->insert(extensions::kExtensionScheme);
560 schemes->insert(extensions::kExtensionResourceScheme);
562 // TODO(kinuko): Handle command-line options for whitelisting
563 // insecure origins. crbug.com/441605