| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 // If the version is newer, remove the old one first. | 156 // If the version is newer, remove the old one first. |
| 157 PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path); | 157 PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path); |
| 158 break; | 158 break; |
| 159 } | 159 } |
| 160 | 160 |
| 161 PluginService::GetInstance()->RegisterInternalPlugin( | 161 PluginService::GetInstance()->RegisterInternalPlugin( |
| 162 plugin_info.ToWebPluginInfo(), true); | 162 plugin_info.ToWebPluginInfo(), true); |
| 163 PluginService::GetInstance()->RefreshPlugins(); | 163 PluginService::GetInstance()->RefreshPlugins(); |
| 164 } | 164 } |
| 165 |
| 166 void NotifyPathServiceAndChrome(const base::FilePath& path, |
| 167 const Version& version) { |
| 168 PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path); |
| 169 BrowserThread::PostTask( |
| 170 BrowserThread::UI, FROM_HERE, |
| 171 base::Bind(&RegisterPepperFlashWithChrome, path, version)); |
| 172 } |
| 165 #endif // !defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) | 173 #endif // !defined(OS_LINUX) && defined(GOOGLE_CHROME_BUILD) |
| 166 | 174 |
| 167 #if defined(GOOGLE_CHROME_BUILD) | 175 #if defined(GOOGLE_CHROME_BUILD) |
| 168 class FlashComponentInstallerTraits : public ComponentInstallerTraits { | 176 class FlashComponentInstallerTraits : public ComponentInstallerTraits { |
| 169 public: | 177 public: |
| 170 FlashComponentInstallerTraits(); | 178 FlashComponentInstallerTraits(); |
| 171 ~FlashComponentInstallerTraits() override {} | 179 ~FlashComponentInstallerTraits() override {} |
| 172 | 180 |
| 173 private: | 181 private: |
| 174 // The following methods override ComponentInstallerTraits. | 182 // The following methods override ComponentInstallerTraits. |
| (...skipping 44 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 29 matching lines...) Expand all Loading... |
| 271 std::unique_ptr<ComponentInstallerTraits> traits( | 278 std::unique_ptr<ComponentInstallerTraits> traits( |
| 272 new FlashComponentInstallerTraits); | 279 new FlashComponentInstallerTraits); |
| 273 // |cus| will take ownership of |installer| during installer->Register(cus). | 280 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 274 DefaultComponentInstaller* installer = | 281 DefaultComponentInstaller* installer = |
| 275 new DefaultComponentInstaller(std::move(traits)); | 282 new DefaultComponentInstaller(std::move(traits)); |
| 276 installer->Register(cus, base::Closure()); | 283 installer->Register(cus, base::Closure()); |
| 277 #endif // defined(GOOGLE_CHROME_BUILD) | 284 #endif // defined(GOOGLE_CHROME_BUILD) |
| 278 } | 285 } |
| 279 | 286 |
| 280 } // namespace component_updater | 287 } // namespace component_updater |
| OLD | NEW |