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/cpu.h" | 8 #include "base/cpu.h" |
9 #include "base/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Once we're sandboxed, we can't know if the PDF plugin is available or not; | 141 // Once we're sandboxed, we can't know if the PDF plugin is available or not; |
142 // but (on Linux) this function is always called once before we're sandboxed. | 142 // but (on Linux) this function is always called once before we're sandboxed. |
143 // So the first time through test if the file is available and then skip the | 143 // So the first time through test if the file is available and then skip the |
144 // check on subsequent calls if yes. | 144 // check on subsequent calls if yes. |
145 static bool skip_pdf_file_check = false; | 145 static bool skip_pdf_file_check = false; |
146 base::FilePath path; | 146 base::FilePath path; |
147 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { | 147 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { |
148 if (skip_pdf_file_check || base::PathExists(path)) { | 148 if (skip_pdf_file_check || base::PathExists(path)) { |
149 content::PepperPluginInfo pdf; | 149 content::PepperPluginInfo pdf; |
150 pdf.path = path; | 150 pdf.path = path; |
151 pdf.name = chrome::ChromeContentClient::kPDFPluginName; | 151 pdf.name = ChromeContentClient::kPDFPluginName; |
152 content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, | 152 content::WebPluginMimeType pdf_mime_type(kPDFPluginMimeType, |
153 kPDFPluginExtension, | 153 kPDFPluginExtension, |
154 kPDFPluginDescription); | 154 kPDFPluginDescription); |
155 content::WebPluginMimeType print_preview_pdf_mime_type( | 155 content::WebPluginMimeType print_preview_pdf_mime_type( |
156 kPDFPluginPrintPreviewMimeType, | 156 kPDFPluginPrintPreviewMimeType, |
157 kPDFPluginExtension, | 157 kPDFPluginExtension, |
158 kPDFPluginDescription); | 158 kPDFPluginDescription); |
159 pdf.mime_types.push_back(pdf_mime_type); | 159 pdf.mime_types.push_back(pdf_mime_type); |
160 pdf.mime_types.push_back(print_preview_pdf_mime_type); | 160 pdf.mime_types.push_back(print_preview_pdf_mime_type); |
161 pdf.permissions = kPDFPluginPermissions; | 161 pdf.permissions = kPDFPluginPermissions; |
162 plugins->push_back(pdf); | 162 plugins->push_back(pdf); |
163 | 163 |
164 skip_pdf_file_check = true; | 164 skip_pdf_file_check = true; |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 // Handle Native Client just like the PDF plugin. This means that it is | 168 // Handle Native Client just like the PDF plugin. This means that it is |
169 // enabled by default for the non-portable case. This allows apps installed | 169 // enabled by default for the non-portable case. This allows apps installed |
170 // from the Chrome Web Store to use NaCl even if the command line switch | 170 // from the Chrome Web Store to use NaCl even if the command line switch |
171 // isn't set. For other uses of NaCl we check for the command line switch. | 171 // isn't set. For other uses of NaCl we check for the command line switch. |
172 // Specifically, Portable Native Client is only enabled by the command line | 172 // Specifically, Portable Native Client is only enabled by the command line |
173 // switch. | 173 // switch. |
174 static bool skip_nacl_file_check = false; | 174 static bool skip_nacl_file_check = false; |
175 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { | 175 if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { |
176 if (skip_nacl_file_check || base::PathExists(path)) { | 176 if (skip_nacl_file_check || base::PathExists(path)) { |
177 content::PepperPluginInfo nacl; | 177 content::PepperPluginInfo nacl; |
178 nacl.path = path; | 178 nacl.path = path; |
179 nacl.name = chrome::ChromeContentClient::kNaClPluginName; | 179 nacl.name = ChromeContentClient::kNaClPluginName; |
180 content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, | 180 content::WebPluginMimeType nacl_mime_type(kNaClPluginMimeType, |
181 kNaClPluginExtension, | 181 kNaClPluginExtension, |
182 kNaClPluginDescription); | 182 kNaClPluginDescription); |
183 nacl.mime_types.push_back(nacl_mime_type); | 183 nacl.mime_types.push_back(nacl_mime_type); |
184 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 184 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
185 switches::kDisablePnacl)) { | 185 switches::kDisablePnacl)) { |
186 content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, | 186 content::WebPluginMimeType pnacl_mime_type(kPnaclPluginMimeType, |
187 kPnaclPluginExtension, | 187 kPnaclPluginExtension, |
188 kPnaclPluginDescription); | 188 kPnaclPluginDescription); |
189 nacl.mime_types.push_back(pnacl_mime_type); | 189 nacl.mime_types.push_back(pnacl_mime_type); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // !defined(WIDEVINE_CDM_IS_COMPONENT) | 323 // !defined(WIDEVINE_CDM_IS_COMPONENT) |
324 | 324 |
325 // The Remoting Viewer plugin is built-in. | 325 // The Remoting Viewer plugin is built-in. |
326 #if defined(ENABLE_REMOTING) | 326 #if defined(ENABLE_REMOTING) |
327 content::PepperPluginInfo info; | 327 content::PepperPluginInfo info; |
328 info.is_internal = true; | 328 info.is_internal = true; |
329 info.is_out_of_process = true; | 329 info.is_out_of_process = true; |
330 info.name = kRemotingViewerPluginName; | 330 info.name = kRemotingViewerPluginName; |
331 info.description = kRemotingViewerPluginDescription; | 331 info.description = kRemotingViewerPluginDescription; |
332 info.path = base::FilePath::FromUTF8Unsafe( | 332 info.path = base::FilePath::FromUTF8Unsafe( |
333 chrome::ChromeContentClient::kRemotingViewerPluginPath); | 333 ChromeContentClient::kRemotingViewerPluginPath); |
334 content::WebPluginMimeType remoting_mime_type( | 334 content::WebPluginMimeType remoting_mime_type( |
335 kRemotingViewerPluginMimeType, | 335 kRemotingViewerPluginMimeType, |
336 kRemotingViewerPluginMimeExtension, | 336 kRemotingViewerPluginMimeExtension, |
337 kRemotingViewerPluginMimeDescription); | 337 kRemotingViewerPluginMimeDescription); |
338 info.mime_types.push_back(remoting_mime_type); | 338 info.mime_types.push_back(remoting_mime_type); |
339 info.internal_entry_points.get_interface = remoting::PPP_GetInterface; | 339 info.internal_entry_points.get_interface = remoting::PPP_GetInterface; |
340 info.internal_entry_points.initialize_module = | 340 info.internal_entry_points.initialize_module = |
341 remoting::PPP_InitializeModule; | 341 remoting::PPP_InitializeModule; |
342 info.internal_entry_points.shutdown_module = remoting::PPP_ShutdownModule; | 342 info.internal_entry_points.shutdown_module = remoting::PPP_ShutdownModule; |
343 info.permissions = kRemotingViewerPluginPermissions; | 343 info.permissions = kRemotingViewerPluginPermissions; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING); | 432 *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING); |
433 return true; | 433 return true; |
434 #else | 434 #else |
435 return false; | 435 return false; |
436 #endif // FLAPPER_AVAILABLE | 436 #endif // FLAPPER_AVAILABLE |
437 } | 437 } |
438 | 438 |
439 } // namespace | 439 } // namespace |
440 | 440 |
441 namespace chrome { | |
442 | |
443 void ChromeContentClient::SetActiveURL(const GURL& url) { | 441 void ChromeContentClient::SetActiveURL(const GURL& url) { |
444 base::debug::SetCrashKeyValue(crash_keys::kActiveURL, | 442 base::debug::SetCrashKeyValue(crash_keys::kActiveURL, |
445 url.possibly_invalid_spec()); | 443 url.possibly_invalid_spec()); |
446 } | 444 } |
447 | 445 |
448 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) { | 446 void ChromeContentClient::SetGpuInfo(const gpu::GPUInfo& gpu_info) { |
449 #if !defined(OS_ANDROID) | 447 #if !defined(OS_ANDROID) |
450 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID, | 448 base::debug::SetCrashKeyValue(crash_keys::kGPUVendorID, |
451 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id)); | 449 base::StringPrintf("0x%04x", gpu_info.gpu.vendor_id)); |
452 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID, | 450 base::debug::SetCrashKeyValue(crash_keys::kGPUDeviceID, |
(...skipping 21 matching lines...) Expand all Loading... |
474 content::PepperPluginInfo plugin; | 472 content::PepperPluginInfo plugin; |
475 if (GetBundledPepperFlash(&plugin)) | 473 if (GetBundledPepperFlash(&plugin)) |
476 plugins->push_back(plugin); | 474 plugins->push_back(plugin); |
477 } | 475 } |
478 | 476 |
479 void ChromeContentClient::AddAdditionalSchemes( | 477 void ChromeContentClient::AddAdditionalSchemes( |
480 std::vector<std::string>* standard_schemes, | 478 std::vector<std::string>* standard_schemes, |
481 std::vector<std::string>* savable_schemes) { | 479 std::vector<std::string>* savable_schemes) { |
482 standard_schemes->push_back(extensions::kExtensionScheme); | 480 standard_schemes->push_back(extensions::kExtensionScheme); |
483 savable_schemes->push_back(extensions::kExtensionScheme); | 481 savable_schemes->push_back(extensions::kExtensionScheme); |
484 standard_schemes->push_back(kExtensionResourceScheme); | 482 standard_schemes->push_back(chrome::kExtensionResourceScheme); |
485 savable_schemes->push_back(kExtensionResourceScheme); | 483 savable_schemes->push_back(chrome::kExtensionResourceScheme); |
486 standard_schemes->push_back(chrome::kChromeSearchScheme); | 484 standard_schemes->push_back(chrome::kChromeSearchScheme); |
487 savable_schemes->push_back(chrome::kChromeSearchScheme); | 485 savable_schemes->push_back(chrome::kChromeSearchScheme); |
488 #if defined(OS_CHROMEOS) | 486 #if defined(OS_CHROMEOS) |
489 standard_schemes->push_back(kCrosScheme); | 487 standard_schemes->push_back(chrome::kCrosScheme); |
490 #endif | 488 #endif |
491 } | 489 } |
492 | 490 |
493 bool ChromeContentClient::CanHandleWhileSwappedOut( | 491 bool ChromeContentClient::CanHandleWhileSwappedOut( |
494 const IPC::Message& msg) { | 492 const IPC::Message& msg) { |
495 // Any Chrome-specific messages (apart from those listed in | 493 // Any Chrome-specific messages (apart from those listed in |
496 // CanSendWhileSwappedOut) that must be handled by the browser when sent from | 494 // CanSendWhileSwappedOut) that must be handled by the browser when sent from |
497 // swapped out renderers. | 495 // swapped out renderers. |
498 return false; | 496 return false; |
499 } | 497 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; | 553 *sandbox_profile_resource_id = IDR_NACL_SANDBOX_PROFILE; |
556 return true; | 554 return true; |
557 } | 555 } |
558 return false; | 556 return false; |
559 } | 557 } |
560 | 558 |
561 std::string ChromeContentClient::GetCarbonInterposePath() const { | 559 std::string ChromeContentClient::GetCarbonInterposePath() const { |
562 return std::string(kInterposeLibraryPath); | 560 return std::string(kInterposeLibraryPath); |
563 } | 561 } |
564 #endif | 562 #endif |
565 | |
566 } // namespace chrome | |
OLD | NEW |