| Index: chrome/browser/component_updater/pepper_flash_component_installer.cc
|
| diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc
|
| index 2ebbb31854080d51bc574bc9aebdb89ad23aa79e..c15f5eae3e1ee7052550fe3f9f4c34666f7ef4be 100644
|
| --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc
|
| +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc
|
| @@ -15,6 +15,7 @@
|
| #include "base/files/file_util.h"
|
| #include "base/logging.h"
|
| #include "base/path_service.h"
|
| +#include "base/stl_util.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| @@ -25,6 +26,7 @@
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_switches.h"
|
| +#include "chrome/common/component_flash_hint_file.h"
|
| #include "chrome/common/pepper_flash.h"
|
| #include "chrome/common/ppapi_utils.h"
|
| #include "components/component_updater/component_updater_service.h"
|
| @@ -33,6 +35,7 @@
|
| #include "content/public/browser/plugin_service.h"
|
| #include "content/public/common/content_constants.h"
|
| #include "content/public/common/pepper_plugin_info.h"
|
| +#include "crypto/sha2.h"
|
| #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. NOLINT
|
| #include "ppapi/shared_impl/ppapi_permissions.h"
|
|
|
| @@ -43,7 +46,7 @@ namespace component_updater {
|
|
|
| namespace {
|
|
|
| -#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
|
| +#if defined(GOOGLE_CHROME_BUILD)
|
| // CRX hash. The extension id is: mimojjlkmoijpicakmndhoigimigcmbb.
|
| const uint8_t kSha2Hash[] = {0xc8, 0xce, 0x99, 0xba, 0xce, 0x89, 0xf8, 0x20,
|
| 0xac, 0xd3, 0x7e, 0x86, 0x8c, 0x86, 0x2c, 0x11,
|
| @@ -53,7 +56,7 @@ const uint8_t kSha2Hash[] = {0xc8, 0xce, 0x99, 0xba, 0xce, 0x89, 0xf8, 0x20,
|
| // If we don't have a Pepper Flash component, this is the version we claim.
|
| const char kNullVersion[] = "0.0.0.0";
|
|
|
| -#endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
|
| +#endif // defined(GOOGLE_CHROME_BUILD)
|
|
|
| // The base directory on Windows looks like:
|
| // <profile>\AppData\Local\Google\Chrome\User Data\PepperFlash\.
|
| @@ -63,7 +66,7 @@ base::FilePath GetPepperFlashBaseDirectory() {
|
| return result;
|
| }
|
|
|
| -#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
|
| +#if defined(GOOGLE_CHROME_BUILD)
|
| // Pepper Flash plugins have the version encoded in the path itself
|
| // so we need to enumerate the directories to find the full path.
|
| // On success, |latest_dir| returns something like:
|
| @@ -99,8 +102,9 @@ bool GetPepperFlashDirectory(base::FilePath* latest_dir,
|
| }
|
| return found;
|
| }
|
| -#endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
|
| +#endif // defined(GOOGLE_CHROME_BUILD)
|
|
|
| +#if !defined(OS_LINUX) || defined(GOOGLE_CHROME_BUILD)
|
| bool MakePepperFlashPluginInfo(const base::FilePath& flash_path,
|
| const Version& flash_version,
|
| bool out_of_process,
|
| @@ -177,6 +181,7 @@ void RegisterPepperFlashWithChrome(const base::FilePath& path,
|
| plugin_info.ToWebPluginInfo(), true);
|
| PluginService::GetInstance()->RefreshPlugins();
|
| }
|
| +#endif // !defined(OS_LINUX) || defined(GOOGLE_CHROME_BUILD)
|
|
|
| } // namespace
|
|
|
| @@ -219,24 +224,41 @@ bool PepperFlashComponentInstaller::Install(
|
| return false;
|
| if (current_version_.CompareTo(version) > 0)
|
| return false;
|
| - if (!base::PathExists(unpack_path.Append(chrome::kPepperFlashPluginFilename)))
|
| + base::FilePath unpacked_plugin =
|
| + unpack_path.Append(chrome::kPepperFlashPluginFilename);
|
| + if (!base::PathExists(unpacked_plugin))
|
| return false;
|
| // Passed the basic tests. Time to install it.
|
| base::FilePath path =
|
| GetPepperFlashBaseDirectory().AppendASCII(version.GetString());
|
| if (base::PathExists(path))
|
| return false;
|
| + current_version_ = version;
|
| +
|
| if (!base::Move(unpack_path, path))
|
| return false;
|
| +#if defined(OS_LINUX)
|
| + base::FilePath flash_path = path.Append(chrome::kPepperFlashPluginFilename);
|
| + // Populate the component updated flash hint file so that the zygote can
|
| + // locate and preload the latest version of flash.
|
| + if (!chrome::ComponentFlashHintFile::RecordFlashUpdate(flash_path, flash_path,
|
| + version.GetString())) {
|
| + if (!base::DeleteFile(path, true))
|
| + LOG(WARNING) << "Hint file creation failed, but unable to delete "
|
| + "installed flash plugin.";
|
| + return false;
|
| + }
|
| +#else
|
| // Installation is done. Now tell the rest of chrome. Both the path service
|
| - // and to the plugin service.
|
| - current_version_ = version;
|
| + // and to the plugin service. On Linux, a restart is required to use the new
|
| + // Flash version, so we do not do this.
|
| PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path);
|
| path = path.Append(chrome::kPepperFlashPluginFilename);
|
| BrowserThread::PostTask(
|
| BrowserThread::UI,
|
| FROM_HERE,
|
| base::Bind(&RegisterPepperFlashWithChrome, path, version));
|
| +#endif // !defined(OS_LINUX)
|
| return true;
|
| }
|
|
|
| @@ -254,7 +276,7 @@ bool PepperFlashComponentInstaller::Uninstall() {
|
|
|
| namespace {
|
|
|
| -#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
|
| +#if defined(GOOGLE_CHROME_BUILD)
|
| void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus,
|
| const Version& version) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| @@ -311,12 +333,12 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
|
| base::DeleteFile(*iter, true);
|
| }
|
| }
|
| -#endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
|
| +#endif // defined(GOOGLE_CHROME_BUILD)
|
|
|
| } // namespace
|
|
|
| void RegisterPepperFlashComponent(ComponentUpdateService* cus) {
|
| -#if defined(GOOGLE_CHROME_BUILD) && !defined(OS_LINUX)
|
| +#if defined(GOOGLE_CHROME_BUILD)
|
| // Component updated flash supersedes bundled flash therefore if that one
|
| // is disabled then this one should never install.
|
| base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
|
|
|