Chromium Code Reviews| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 content::kFlashPluginSwfDescription); | 273 content::kFlashPluginSwfDescription); |
| 274 plugin.mime_types.push_back(swf_mime_type); | 274 plugin.mime_types.push_back(swf_mime_type); |
| 275 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType, | 275 content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType, |
| 276 content::kFlashPluginSplExtension, | 276 content::kFlashPluginSplExtension, |
| 277 content::kFlashPluginSplDescription); | 277 content::kFlashPluginSplDescription); |
| 278 plugin.mime_types.push_back(spl_mime_type); | 278 plugin.mime_types.push_back(spl_mime_type); |
| 279 | 279 |
| 280 return plugin; | 280 return plugin; |
| 281 } | 281 } |
| 282 | 282 |
| 283 void AddPepperFlashFromCommandLine( | 283 bool GetCommandLinePepperFlash(content::PepperPluginInfo* plugin) { |
| 284 std::vector<content::PepperPluginInfo>* plugins) { | |
| 285 const base::CommandLine::StringType flash_path = | 284 const base::CommandLine::StringType flash_path = |
| 286 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( | 285 base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( |
| 287 switches::kPpapiFlashPath); | 286 switches::kPpapiFlashPath); |
| 288 if (flash_path.empty()) | 287 if (flash_path.empty()) |
| 289 return; | 288 return false; |
| 290 | 289 |
| 291 // Also get the version from the command-line. Should be something like 11.2 | 290 // Also get the version from the command-line. Should be something like 11.2 |
| 292 // or 11.2.123.45. | 291 // or 11.2.123.45. |
| 293 std::string flash_version = | 292 std::string flash_version = |
| 294 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 293 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 295 switches::kPpapiFlashVersion); | 294 switches::kPpapiFlashVersion); |
| 296 | 295 |
| 297 plugins->push_back( | 296 *plugin = CreatePepperFlashInfo(base::FilePath(flash_path), |
| 298 CreatePepperFlashInfo(base::FilePath(flash_path), | 297 flash_version, false, true, false); |
| 299 flash_version, false, true, false)); | 298 return true; |
| 300 } | 299 } |
| 301 | 300 |
| 302 #if defined(OS_LINUX) | 301 #if defined(OS_LINUX) |
| 303 // This method is used on Linux only because of architectural differences in how | 302 // This method is used on Linux only because of architectural differences in how |
| 304 // it loads the component updated flash plugin, and not because the other | 303 // it loads the component updated flash plugin, and not because the other |
| 305 // platforms do not support component updated flash. On other platforms, the | 304 // platforms do not support component updated flash. On other platforms, the |
| 306 // component updater sends an IPC message to all threads, at undefined points in | 305 // component updater sends an IPC message to all threads, at undefined points in |
| 307 // time, with the URL of the component updated flash. Because the linux zygote | 306 // time, with the URL of the component updated flash. Because the linux zygote |
| 308 // thread has no access to the file system after it warms up, it must preload | 307 // thread has no access to the file system after it warms up, it must preload |
| 309 // the component updated flash. | 308 // the component updated flash. |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 } | 472 } |
| 474 | 473 |
| 475 return plugin_map.rbegin()->second; | 474 return plugin_map.rbegin()->second; |
| 476 } | 475 } |
| 477 #endif // defined(ENABLE_PLUGINS) | 476 #endif // defined(ENABLE_PLUGINS) |
| 478 | 477 |
| 479 void ChromeContentClient::AddPepperPlugins( | 478 void ChromeContentClient::AddPepperPlugins( |
| 480 std::vector<content::PepperPluginInfo>* plugins) { | 479 std::vector<content::PepperPluginInfo>* plugins) { |
| 481 #if defined(ENABLE_PLUGINS) | 480 #if defined(ENABLE_PLUGINS) |
| 482 ComputeBuiltInPlugins(plugins); | 481 ComputeBuiltInPlugins(plugins); |
| 483 AddPepperFlashFromCommandLine(plugins); | |
| 484 | 482 |
| 485 #if defined(OS_LINUX) | 483 #if defined(OS_LINUX) |
| 486 // Depending on the sandbox configurtion, the user data directory | 484 // Depending on the sandbox configuration, the user data directory |
| 487 // is not always available. If it is not available, do not try and load any | 485 // is not always available. If it is not available, do not try and load any |
| 488 // flash plugin. The flash player, if any, preloaded before the sandbox | 486 // flash plugin. The flash player, if any, preloaded before the sandbox |
| 489 // initialization will continue to be used. | 487 // initialization will continue to be used. |
| 490 if (!sandbox::Credentials::HasFileSystemAccess()) { | 488 if (!sandbox::Credentials::HasFileSystemAccess()) { |
| 491 return; | 489 return; |
| 492 } | 490 } |
| 493 #endif // defined(OS_LINUX) | 491 #endif // defined(OS_LINUX) |
| 494 | 492 |
| 495 ScopedVector<content::PepperPluginInfo> flash_versions; | 493 ScopedVector<content::PepperPluginInfo> flash_versions; |
| 494 std::unique_ptr<content::PepperPluginInfo> command_line_flash( | |
|
Nico
2016/09/27 21:09:14
why is this on the heap?
Also, why the api changi
Greg K
2016/09/27 21:12:29
FWIW, since the other functions take a PepperPlugi
Nico
2016/09/27 21:13:40
I like CLs that do one thing per CL: Either change
waffles
2016/09/27 21:44:52
Passing flash_versions was my first thought, but s
Nico
2016/09/27 21:46:24
Ah, I had missed that flash_versions is a ScopedVe
| |
| 495 new content::PepperPluginInfo); | |
| 496 if (GetCommandLinePepperFlash(command_line_flash.get())) | |
| 497 flash_versions.push_back(command_line_flash.release()); | |
| 496 | 498 |
| 497 #if defined(OS_LINUX) | 499 #if defined(OS_LINUX) |
| 498 std::unique_ptr<content::PepperPluginInfo> component_flash( | 500 std::unique_ptr<content::PepperPluginInfo> component_flash( |
| 499 new content::PepperPluginInfo); | 501 new content::PepperPluginInfo); |
| 500 if (GetComponentUpdatedPepperFlash(component_flash.get())) | 502 if (GetComponentUpdatedPepperFlash(component_flash.get())) |
| 501 flash_versions.push_back(component_flash.release()); | 503 flash_versions.push_back(component_flash.release()); |
| 502 #endif // defined(OS_LINUX) | 504 #endif // defined(OS_LINUX) |
| 503 | 505 |
| 504 std::unique_ptr<content::PepperPluginInfo> system_flash( | 506 std::unique_ptr<content::PepperPluginInfo> system_flash( |
| 505 new content::PepperPluginInfo); | 507 new content::PepperPluginInfo); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 681 if (!origin_trial_policy_) | 683 if (!origin_trial_policy_) |
| 682 origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>(); | 684 origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>(); |
| 683 return origin_trial_policy_.get(); | 685 return origin_trial_policy_.get(); |
| 684 } | 686 } |
| 685 | 687 |
| 686 #if defined(OS_ANDROID) | 688 #if defined(OS_ANDROID) |
| 687 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() { | 689 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() { |
| 688 return new ChromeMediaClientAndroid(); | 690 return new ChromeMediaClientAndroid(); |
| 689 } | 691 } |
| 690 #endif // OS_ANDROID | 692 #endif // OS_ANDROID |
| OLD | NEW |