| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/browser/component_updater/pepper_flash_component_installer.h" | 5 #include "chrome/browser/component_updater/pepper_flash_component_installer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool IsPepperFlash(const content::WebPluginInfo& plugin) { | 100 bool IsPepperFlash(const content::WebPluginInfo& plugin) { |
| 101 // We try to recognize Pepper Flash by the following criteria: | 101 // We try to recognize Pepper Flash by the following criteria: |
| 102 // * It is a Pepper plugin. | 102 // * It is a Pepper plugin. |
| 103 // * It has the special Flash permissions. | 103 // * It has the special Flash permissions. |
| 104 return plugin.is_pepper_plugin() && | 104 return plugin.is_pepper_plugin() && |
| 105 (plugin.pepper_permissions & ppapi::PERMISSION_FLASH); | 105 (plugin.pepper_permissions & ppapi::PERMISSION_FLASH); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void NotifyPathServiceAndChrome(const base::FilePath& path, |
| 109 const Version& version) { |
| 110 PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path); |
| 111 BrowserThread::PostTask( |
| 112 BrowserThread::UI, FROM_HERE, |
| 113 base::Bind(&RegisterPepperFlashWithChrome, path, version)); |
| 114 } |
| 115 |
| 108 void RegisterPepperFlashWithChrome(const base::FilePath& path, | 116 void RegisterPepperFlashWithChrome(const base::FilePath& path, |
| 109 const Version& version) { | 117 const Version& version) { |
| 110 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 118 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 111 content::PepperPluginInfo plugin_info; | 119 content::PepperPluginInfo plugin_info; |
| 112 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) | 120 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) |
| 113 return; | 121 return; |
| 114 | 122 |
| 115 base::FilePath bundled_flash_dir; | 123 base::FilePath bundled_flash_dir; |
| 116 PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &bundled_flash_dir); | 124 PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &bundled_flash_dir); |
| 117 base::FilePath system_flash_path; | 125 base::FilePath system_flash_path; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 227 } |
| 220 | 228 |
| 221 void FlashComponentInstallerTraits::ComponentReady( | 229 void FlashComponentInstallerTraits::ComponentReady( |
| 222 const base::Version& version, | 230 const base::Version& version, |
| 223 const base::FilePath& path, | 231 const base::FilePath& path, |
| 224 std::unique_ptr<base::DictionaryValue> manifest) { | 232 std::unique_ptr<base::DictionaryValue> manifest) { |
| 225 #if !defined(OS_LINUX) | 233 #if !defined(OS_LINUX) |
| 226 // Installation is done. Now tell the rest of chrome. Both the path service | 234 // Installation is done. Now tell the rest of chrome. Both the path service |
| 227 // and to the plugin service. On Linux, a restart is required to use the new | 235 // and to the plugin service. On Linux, a restart is required to use the new |
| 228 // Flash version, so we do not do this. | 236 // Flash version, so we do not do this. |
| 229 PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path); | 237 BrowserThread::GetBlockingPool()->PostTask( |
| 230 RegisterPepperFlashWithChrome(path.Append(chrome::kPepperFlashPluginFilename), | 238 FROM_HERE, base::Bind(&NotifyPathServiceAndChrome, path, version)); |
| 231 version); | |
| 232 #endif // !defined(OS_LINUX) | 239 #endif // !defined(OS_LINUX) |
| 233 } | 240 } |
| 234 | 241 |
| 235 bool FlashComponentInstallerTraits::VerifyInstallation( | 242 bool FlashComponentInstallerTraits::VerifyInstallation( |
| 236 const base::DictionaryValue& manifest, | 243 const base::DictionaryValue& manifest, |
| 237 const base::FilePath& install_dir) const { | 244 const base::FilePath& install_dir) const { |
| 238 Version unused; | 245 Version unused; |
| 239 return chrome::CheckPepperFlashManifest(manifest, &unused); | 246 return chrome::CheckPepperFlashManifest(manifest, &unused); |
| 240 } | 247 } |
| 241 | 248 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 270 std::unique_ptr<ComponentInstallerTraits> traits( | 277 std::unique_ptr<ComponentInstallerTraits> traits( |
| 271 new FlashComponentInstallerTraits); | 278 new FlashComponentInstallerTraits); |
| 272 // |cus| will take ownership of |installer| during installer->Register(cus). | 279 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 273 DefaultComponentInstaller* installer = | 280 DefaultComponentInstaller* installer = |
| 274 new DefaultComponentInstaller(std::move(traits)); | 281 new DefaultComponentInstaller(std::move(traits)); |
| 275 installer->Register(cus, base::Closure()); | 282 installer->Register(cus, base::Closure()); |
| 276 #endif // defined(GOOGLE_CHROME_BUILD) | 283 #endif // defined(GOOGLE_CHROME_BUILD) |
| 277 } | 284 } |
| 278 | 285 |
| 279 } // namespace component_updater | 286 } // namespace component_updater |
| OLD | NEW |