| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 474 } |
| 475 #endif // BUILDFLAG(ENABLE_PLUGINS) | 475 #endif // BUILDFLAG(ENABLE_PLUGINS) |
| 476 | 476 |
| 477 void ChromeContentClient::AddPepperPlugins( | 477 void ChromeContentClient::AddPepperPlugins( |
| 478 std::vector<content::PepperPluginInfo>* plugins) { | 478 std::vector<content::PepperPluginInfo>* plugins) { |
| 479 #if BUILDFLAG(ENABLE_PLUGINS) | 479 #if BUILDFLAG(ENABLE_PLUGINS) |
| 480 ComputeBuiltInPlugins(plugins); | 480 ComputeBuiltInPlugins(plugins); |
| 481 | 481 |
| 482 // If flash is disabled, do not try to add any flash plugin. | 482 // If flash is disabled, do not try to add any flash plugin. |
| 483 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 483 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 484 if (command_line->HasSwitch(switches::kDisableBundledPpapiFlash)) | 484 bool disable_bundled_flash = |
| 485 return; | 485 command_line->HasSwitch(switches::kDisableBundledPpapiFlash); |
| 486 | 486 |
| 487 std::vector<std::unique_ptr<content::PepperPluginInfo>> flash_versions; | 487 std::vector<std::unique_ptr<content::PepperPluginInfo>> flash_versions; |
| 488 | 488 |
| 489 // Get component updated flash for desktop Linux and Chrome OS. | 489 // Get component updated flash for desktop Linux and Chrome OS. |
| 490 #if defined(OS_LINUX) | 490 #if defined(OS_LINUX) |
| 491 // Depending on the sandbox configuration, the file system | 491 // Depending on the sandbox configuration, the file system |
| 492 // is not always available. If it is not available, do not try and load any | 492 // is not always available. If it is not available, do not try and load any |
| 493 // flash plugin. The flash player, if any, preloaded before the sandbox | 493 // flash plugin. The flash player, if any, preloaded before the sandbox |
| 494 // initialization will continue to be used. | 494 // initialization will continue to be used. |
| 495 if (!sandbox::Credentials::HasFileSystemAccess()) | 495 if (!sandbox::Credentials::HasFileSystemAccess()) |
| 496 return; | 496 return; |
| 497 | 497 |
| 498 auto component_flash = base::MakeUnique<content::PepperPluginInfo>(); | 498 auto component_flash = base::MakeUnique<content::PepperPluginInfo>(); |
| 499 if (GetComponentUpdatedPepperFlash(component_flash.get())) | 499 if (!disable_bundled_flash && |
| 500 GetComponentUpdatedPepperFlash(component_flash.get())) |
| 500 flash_versions.push_back(std::move(component_flash)); | 501 flash_versions.push_back(std::move(component_flash)); |
| 501 #endif // defined(OS_LINUX) | 502 #endif // defined(OS_LINUX) |
| 502 | 503 |
| 503 auto command_line_flash = base::MakeUnique<content::PepperPluginInfo>(); | 504 auto command_line_flash = base::MakeUnique<content::PepperPluginInfo>(); |
| 504 if (GetCommandLinePepperFlash(command_line_flash.get())) | 505 if (GetCommandLinePepperFlash(command_line_flash.get())) |
| 505 flash_versions.push_back(std::move(command_line_flash)); | 506 flash_versions.push_back(std::move(command_line_flash)); |
| 506 | 507 |
| 507 auto system_flash = base::MakeUnique<content::PepperPluginInfo>(); | 508 auto system_flash = base::MakeUnique<content::PepperPluginInfo>(); |
| 508 if (GetSystemPepperFlash(system_flash.get())) | 509 if (GetSystemPepperFlash(system_flash.get())) |
| 509 flash_versions.push_back(std::move(system_flash)); | 510 flash_versions.push_back(std::move(system_flash)); |
| 510 | 511 |
| 511 // This function will return only the most recent version of the flash plugin. | 512 // This function will return only the most recent version of the flash plugin. |
| 512 content::PepperPluginInfo* max_flash = FindMostRecentPlugin(flash_versions); | 513 content::PepperPluginInfo* max_flash = FindMostRecentPlugin(flash_versions); |
| 513 if (max_flash) { | 514 if (max_flash) { |
| 514 plugins->push_back(*max_flash); | 515 plugins->push_back(*max_flash); |
| 515 } else { | 516 } else if (!disable_bundled_flash) { |
| 516 #if defined(GOOGLE_CHROME_BUILD) && defined(FLAPPER_AVAILABLE) | 517 #if defined(GOOGLE_CHROME_BUILD) && defined(FLAPPER_AVAILABLE) |
| 517 // Add a fake Flash plugin even though it doesn't actually exist - if a | 518 // Add a fake Flash plugin even though it doesn't actually exist - if a |
| 518 // web page requests it, it will be component-updated on-demand. There is | 519 // web page requests it, it will be component-updated on-demand. There is |
| 519 // nothing that guarantees the component update will give us the | 520 // nothing that guarantees the component update will give us the |
| 520 // FLAPPER_VERSION_STRING version of Flash, but using this version seems | 521 // FLAPPER_VERSION_STRING version of Flash, but using this version seems |
| 521 // better than any other hardcoded alternative. | 522 // better than any other hardcoded alternative. |
| 522 plugins->push_back(CreatePepperFlashInfo( | 523 plugins->push_back(CreatePepperFlashInfo( |
| 523 base::FilePath::FromUTF8Unsafe(ChromeContentClient::kNotPresent), | 524 base::FilePath::FromUTF8Unsafe(ChromeContentClient::kNotPresent), |
| 524 FLAPPER_VERSION_STRING, false)); | 525 FLAPPER_VERSION_STRING, false)); |
| 525 #endif // defined(GOOGLE_CHROME_BUILD) && defined(FLAPPER_AVAILABLE) | 526 #endif // defined(GOOGLE_CHROME_BUILD) && defined(FLAPPER_AVAILABLE) |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 if (!origin_trial_policy_) | 699 if (!origin_trial_policy_) |
| 699 origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>(); | 700 origin_trial_policy_ = base::MakeUnique<ChromeOriginTrialPolicy>(); |
| 700 return origin_trial_policy_.get(); | 701 return origin_trial_policy_.get(); |
| 701 } | 702 } |
| 702 | 703 |
| 703 #if defined(OS_ANDROID) | 704 #if defined(OS_ANDROID) |
| 704 media::MediaDrmBridgeClient* ChromeContentClient::GetMediaDrmBridgeClient() { | 705 media::MediaDrmBridgeClient* ChromeContentClient::GetMediaDrmBridgeClient() { |
| 705 return new ChromeMediaDrmBridgeClient(); | 706 return new ChromeMediaDrmBridgeClient(); |
| 706 } | 707 } |
| 707 #endif // OS_ANDROID | 708 #endif // OS_ANDROID |
| OLD | NEW |