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 | |
116 void RegisterPepperFlashWithChrome(const base::FilePath& path, | 108 void RegisterPepperFlashWithChrome(const base::FilePath& path, |
117 const Version& version) { | 109 const Version& version) { |
118 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 110 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
119 content::PepperPluginInfo plugin_info; | 111 content::PepperPluginInfo plugin_info; |
120 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) | 112 if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info)) |
121 return; | 113 return; |
122 | 114 |
123 base::FilePath bundled_flash_dir; | 115 base::FilePath bundled_flash_dir; |
124 PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &bundled_flash_dir); | 116 PathService::Get(chrome::DIR_PEPPER_FLASH_PLUGIN, &bundled_flash_dir); |
125 base::FilePath system_flash_path; | 117 base::FilePath system_flash_path; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 219 } |
228 | 220 |
229 void FlashComponentInstallerTraits::ComponentReady( | 221 void FlashComponentInstallerTraits::ComponentReady( |
230 const base::Version& version, | 222 const base::Version& version, |
231 const base::FilePath& path, | 223 const base::FilePath& path, |
232 std::unique_ptr<base::DictionaryValue> manifest) { | 224 std::unique_ptr<base::DictionaryValue> manifest) { |
233 #if !defined(OS_LINUX) | 225 #if !defined(OS_LINUX) |
234 // Installation is done. Now tell the rest of chrome. Both the path service | 226 // Installation is done. Now tell the rest of chrome. Both the path service |
235 // and to the plugin service. On Linux, a restart is required to use the new | 227 // and to the plugin service. On Linux, a restart is required to use the new |
236 // Flash version, so we do not do this. | 228 // Flash version, so we do not do this. |
237 BrowserThread::GetBlockingPool()->PostTask( | 229 PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path); |
238 FROM_HERE, base::Bind(&NotifyPathServiceAndChrome, path, version)); | 230 RegisterPepperFlashWithChrome(path.Append(chrome::kPepperFlashPluginFilename), |
| 231 version); |
239 #endif // !defined(OS_LINUX) | 232 #endif // !defined(OS_LINUX) |
240 } | 233 } |
241 | 234 |
242 bool FlashComponentInstallerTraits::VerifyInstallation( | 235 bool FlashComponentInstallerTraits::VerifyInstallation( |
243 const base::DictionaryValue& manifest, | 236 const base::DictionaryValue& manifest, |
244 const base::FilePath& install_dir) const { | 237 const base::FilePath& install_dir) const { |
245 Version unused; | 238 Version unused; |
246 return chrome::CheckPepperFlashManifest(manifest, &unused); | 239 return chrome::CheckPepperFlashManifest(manifest, &unused); |
247 } | 240 } |
248 | 241 |
(...skipping 28 matching lines...) Expand all Loading... |
277 std::unique_ptr<ComponentInstallerTraits> traits( | 270 std::unique_ptr<ComponentInstallerTraits> traits( |
278 new FlashComponentInstallerTraits); | 271 new FlashComponentInstallerTraits); |
279 // |cus| will take ownership of |installer| during installer->Register(cus). | 272 // |cus| will take ownership of |installer| during installer->Register(cus). |
280 DefaultComponentInstaller* installer = | 273 DefaultComponentInstaller* installer = |
281 new DefaultComponentInstaller(std::move(traits)); | 274 new DefaultComponentInstaller(std::move(traits)); |
282 installer->Register(cus, base::Closure()); | 275 installer->Register(cus, base::Closure()); |
283 #endif // defined(GOOGLE_CHROME_BUILD) | 276 #endif // defined(GOOGLE_CHROME_BUILD) |
284 } | 277 } |
285 | 278 |
286 } // namespace component_updater | 279 } // namespace component_updater |
OLD | NEW |