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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 return true; | 333 return true; |
334 } | 334 } |
335 LOG(ERROR) | 335 LOG(ERROR) |
336 << "Failed to locate and load the component updated flash plugin."; | 336 << "Failed to locate and load the component updated flash plugin."; |
337 } | 337 } |
338 #endif // defined(FLAPPER_AVAILABLE) | 338 #endif // defined(FLAPPER_AVAILABLE) |
339 return false; | 339 return false; |
340 } | 340 } |
341 #endif // defined(OS_LINUX) | 341 #endif // defined(OS_LINUX) |
342 | 342 |
343 #if defined(OS_CHROMEOS) | |
344 // This should be used on ChromeOS only - other platforms do not bundle Flash. | |
345 bool GetBundledPepperFlash(content::PepperPluginInfo* plugin) { | |
346 #if defined(FLAPPER_AVAILABLE) | |
347 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
348 | |
349 // Ignore bundled Pepper Flash if there is Pepper Flash specified from the | |
350 // command-line. | |
351 if (command_line->HasSwitch(switches::kPpapiFlashPath)) | |
352 return false; | |
353 | |
354 bool force_disable = | |
355 command_line->HasSwitch(switches::kDisableBundledPpapiFlash); | |
356 if (force_disable) | |
357 return false; | |
358 | |
359 base::FilePath flash_path; | |
360 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_PLUGIN, &flash_path)) | |
361 return false; | |
362 | |
363 *plugin = CreatePepperFlashInfo(flash_path, FLAPPER_VERSION_STRING, false, | |
364 false, true); | |
365 return true; | |
366 #else | |
367 return false; | |
368 #endif // FLAPPER_AVAILABLE | |
369 } | |
370 #endif // defined(OS_CHROMEOS) | |
371 | |
372 bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { | 343 bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { |
373 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 344 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
374 // Do not try and find System Pepper Flash if there is a specific path on | 345 // Do not try and find System Pepper Flash if there is a specific path on |
375 // the commmand-line. | 346 // the commmand-line. |
376 if (command_line->HasSwitch(switches::kPpapiFlashPath)) | 347 if (command_line->HasSwitch(switches::kPpapiFlashPath)) |
377 return false; | 348 return false; |
378 | 349 |
379 base::FilePath flash_filename; | 350 base::FilePath flash_filename; |
380 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN, | 351 if (!PathService::Get(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN, |
381 &flash_filename)) | 352 &flash_filename)) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 } | 479 } |
509 | 480 |
510 return plugin_map.rbegin()->second; | 481 return plugin_map.rbegin()->second; |
511 } | 482 } |
512 #endif // defined(ENABLE_PLUGINS) | 483 #endif // defined(ENABLE_PLUGINS) |
513 | 484 |
514 void ChromeContentClient::AddPepperPlugins( | 485 void ChromeContentClient::AddPepperPlugins( |
515 std::vector<content::PepperPluginInfo>* plugins) { | 486 std::vector<content::PepperPluginInfo>* plugins) { |
516 #if defined(ENABLE_PLUGINS) | 487 #if defined(ENABLE_PLUGINS) |
517 ComputeBuiltInPlugins(plugins); | 488 ComputeBuiltInPlugins(plugins); |
518 AddPepperFlashFromCommandLine(plugins); | 489 AddPepperFlashFromCommandLine(plugins); |
waffles
2016/09/15 18:05:13
I would like to refactor AddPepperFlashFromCommand
Will Harris
2016/09/16 17:03:34
Fake Flash is only registered on Chrome builds, ri
| |
519 | 490 |
520 #if defined(OS_LINUX) | 491 #if defined(OS_LINUX) |
521 // Depending on the sandbox configurtion, the user data directory | 492 // Depending on the sandbox configurtion, the user data directory |
522 // is not always available. If it is not available, do not try and load any | 493 // is not always available. If it is not available, do not try and load any |
523 // flash plugin. The flash player, if any, preloaded before the sandbox | 494 // flash plugin. The flash player, if any, preloaded before the sandbox |
524 // initialization will continue to be used. | 495 // initialization will continue to be used. |
525 if (!IsUserDataDirAvailable()) { | 496 if (!IsUserDataDirAvailable()) { |
526 return; | 497 return; |
527 } | 498 } |
528 #endif // defined(OS_LINUX) | 499 #endif // defined(OS_LINUX) |
529 | 500 |
530 ScopedVector<content::PepperPluginInfo> flash_versions; | 501 ScopedVector<content::PepperPluginInfo> flash_versions; |
531 | 502 |
532 #if defined(OS_LINUX) | 503 #if defined(OS_LINUX) |
533 std::unique_ptr<content::PepperPluginInfo> component_flash( | 504 std::unique_ptr<content::PepperPluginInfo> component_flash( |
534 new content::PepperPluginInfo); | 505 new content::PepperPluginInfo); |
535 if (GetComponentUpdatedPepperFlash(component_flash.get())) | 506 if (GetComponentUpdatedPepperFlash(component_flash.get())) |
536 flash_versions.push_back(component_flash.release()); | 507 flash_versions.push_back(component_flash.release()); |
537 #endif // defined(OS_LINUX) | 508 #endif // defined(OS_LINUX) |
538 | 509 |
539 #if defined(OS_CHROMEOS) | |
540 std::unique_ptr<content::PepperPluginInfo> bundled_flash( | |
541 new content::PepperPluginInfo); | |
542 if (GetBundledPepperFlash(bundled_flash.get())) | |
543 flash_versions.push_back(bundled_flash.release()); | |
544 #endif // defined(OS_CHROMEOS) | |
545 | |
546 std::unique_ptr<content::PepperPluginInfo> system_flash( | 510 std::unique_ptr<content::PepperPluginInfo> system_flash( |
547 new content::PepperPluginInfo); | 511 new content::PepperPluginInfo); |
548 if (GetSystemPepperFlash(system_flash.get())) | 512 if (GetSystemPepperFlash(system_flash.get())) |
549 flash_versions.push_back(system_flash.release()); | 513 flash_versions.push_back(system_flash.release()); |
550 | 514 |
551 // This function will return only the most recent version of the flash plugin. | 515 // This function will return only the most recent version of the flash plugin. |
552 content::PepperPluginInfo* max_flash = | 516 content::PepperPluginInfo* max_flash = |
553 FindMostRecentPlugin(flash_versions.get()); | 517 FindMostRecentPlugin(flash_versions.get()); |
554 if (max_flash) { | 518 if (max_flash) { |
555 plugins->push_back(*max_flash); | 519 plugins->push_back(*max_flash); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
724 origin_trial_policy_ = base::WrapUnique(new ChromeOriginTrialPolicy()); | 688 origin_trial_policy_ = base::WrapUnique(new ChromeOriginTrialPolicy()); |
725 } | 689 } |
726 return origin_trial_policy_.get(); | 690 return origin_trial_policy_.get(); |
727 } | 691 } |
728 | 692 |
729 #if defined(OS_ANDROID) | 693 #if defined(OS_ANDROID) |
730 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() { | 694 media::MediaClientAndroid* ChromeContentClient::GetMediaClientAndroid() { |
731 return new ChromeMediaClientAndroid(); | 695 return new ChromeMediaClientAndroid(); |
732 } | 696 } |
733 #endif // OS_ANDROID | 697 #endif // OS_ANDROID |
OLD | NEW |