| 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 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/plugins/plugin_prefs.h" | 29 #include "chrome/browser/plugins/plugin_prefs.h" |
| 30 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_content_client.h" | 31 #include "chrome/common/chrome_content_client.h" |
| 32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
| 33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/pepper_flash.h" | 34 #include "chrome/common/pepper_flash.h" |
| 35 #include "chrome/common/ppapi_utils.h" | 35 #include "chrome/common/ppapi_utils.h" |
| 36 #include "components/component_updater/component_updater_service.h" | 36 #include "components/component_updater/component_updater_service.h" |
| 37 #include "components/component_updater/default_component_installer.h" | 37 #include "components/component_updater/default_component_installer.h" |
| 38 #include "components/update_client/update_client.h" | 38 #include "components/update_client/update_client.h" |
| 39 #include "components/update_client/update_client_errors.h" |
| 39 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/plugin_service.h" | 41 #include "content/public/browser/plugin_service.h" |
| 41 #include "content/public/common/content_constants.h" | 42 #include "content/public/common/content_constants.h" |
| 42 #include "content/public/common/pepper_plugin_info.h" | 43 #include "content/public/common/pepper_plugin_info.h" |
| 43 #include "ppapi/shared_impl/ppapi_permissions.h" | 44 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 44 | 45 |
| 45 #if defined(OS_LINUX) | 46 #if defined(OS_LINUX) |
| 46 #include "chrome/common/component_flash_hint_file_linux.h" | 47 #include "chrome/common/component_flash_hint_file_linux.h" |
| 47 #endif // defined(OS_LINUX) | 48 #endif // defined(OS_LINUX) |
| 48 | 49 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 #if defined(GOOGLE_CHROME_BUILD) | 153 #if defined(GOOGLE_CHROME_BUILD) |
| 153 class FlashComponentInstallerTraits : public ComponentInstallerTraits { | 154 class FlashComponentInstallerTraits : public ComponentInstallerTraits { |
| 154 public: | 155 public: |
| 155 FlashComponentInstallerTraits(); | 156 FlashComponentInstallerTraits(); |
| 156 ~FlashComponentInstallerTraits() override {} | 157 ~FlashComponentInstallerTraits() override {} |
| 157 | 158 |
| 158 private: | 159 private: |
| 159 // The following methods override ComponentInstallerTraits. | 160 // The following methods override ComponentInstallerTraits. |
| 160 bool SupportsGroupPolicyEnabledComponentUpdates() const override; | 161 bool SupportsGroupPolicyEnabledComponentUpdates() const override; |
| 161 bool RequiresNetworkEncryption() const override; | 162 bool RequiresNetworkEncryption() const override; |
| 162 bool OnCustomInstall(const base::DictionaryValue& manifest, | 163 update_client::CrxInstaller::Result OnCustomInstall( |
| 163 const base::FilePath& install_dir) override; | 164 const base::DictionaryValue& manifest, |
| 165 const base::FilePath& install_dir) override; |
| 164 bool VerifyInstallation(const base::DictionaryValue& manifest, | 166 bool VerifyInstallation(const base::DictionaryValue& manifest, |
| 165 const base::FilePath& install_dir) const override; | 167 const base::FilePath& install_dir) const override; |
| 166 void ComponentReady(const base::Version& version, | 168 void ComponentReady(const base::Version& version, |
| 167 const base::FilePath& path, | 169 const base::FilePath& path, |
| 168 std::unique_ptr<base::DictionaryValue> manifest) override; | 170 std::unique_ptr<base::DictionaryValue> manifest) override; |
| 169 base::FilePath GetRelativeInstallDir() const override; | 171 base::FilePath GetRelativeInstallDir() const override; |
| 170 void GetHash(std::vector<uint8_t>* hash) const override; | 172 void GetHash(std::vector<uint8_t>* hash) const override; |
| 171 std::string GetName() const override; | 173 std::string GetName() const override; |
| 172 update_client::InstallerAttributes GetInstallerAttributes() const override; | 174 update_client::InstallerAttributes GetInstallerAttributes() const override; |
| 173 std::vector<std::string> GetMimeTypes() const override; | 175 std::vector<std::string> GetMimeTypes() const override; |
| 174 | 176 |
| 175 DISALLOW_COPY_AND_ASSIGN(FlashComponentInstallerTraits); | 177 DISALLOW_COPY_AND_ASSIGN(FlashComponentInstallerTraits); |
| 176 }; | 178 }; |
| 177 | 179 |
| 178 FlashComponentInstallerTraits::FlashComponentInstallerTraits() {} | 180 FlashComponentInstallerTraits::FlashComponentInstallerTraits() {} |
| 179 | 181 |
| 180 bool FlashComponentInstallerTraits::SupportsGroupPolicyEnabledComponentUpdates() | 182 bool FlashComponentInstallerTraits::SupportsGroupPolicyEnabledComponentUpdates() |
| 181 const { | 183 const { |
| 182 return true; | 184 return true; |
| 183 } | 185 } |
| 184 | 186 |
| 185 bool FlashComponentInstallerTraits::RequiresNetworkEncryption() const { | 187 bool FlashComponentInstallerTraits::RequiresNetworkEncryption() const { |
| 186 return false; | 188 return false; |
| 187 } | 189 } |
| 188 | 190 |
| 189 bool FlashComponentInstallerTraits::OnCustomInstall( | 191 update_client::CrxInstaller::Result |
| 192 FlashComponentInstallerTraits::OnCustomInstall( |
| 190 const base::DictionaryValue& manifest, | 193 const base::DictionaryValue& manifest, |
| 191 const base::FilePath& install_dir) { | 194 const base::FilePath& install_dir) { |
| 192 #if defined(OS_LINUX) | 195 #if defined(OS_LINUX) |
| 193 const base::FilePath flash_path = | 196 const base::FilePath flash_path = |
| 194 install_dir.Append(chrome::kPepperFlashPluginFilename); | 197 install_dir.Append(chrome::kPepperFlashPluginFilename); |
| 195 // Populate the component updated flash hint file so that the zygote can | 198 // Populate the component updated flash hint file so that the zygote can |
| 196 // locate and preload the latest version of flash. | 199 // locate and preload the latest version of flash. |
| 197 std::string version; | 200 std::string version; |
| 198 if (!manifest.GetString("version", &version)) | 201 if (!manifest.GetString("version", &version)) { |
| 199 return false; | 202 return update_client::CrxInstaller::Result( |
| 203 update_client::InstallError::GENERIC_ERROR); |
| 204 } |
| 200 if (!component_flash_hint_file::RecordFlashUpdate(flash_path, flash_path, | 205 if (!component_flash_hint_file::RecordFlashUpdate(flash_path, flash_path, |
| 201 version)) { | 206 version)) { |
| 202 return false; | 207 return update_client::CrxInstaller::Result( |
| 208 update_client::InstallError::GENERIC_ERROR); |
| 203 } | 209 } |
| 204 #endif // defined(OS_LINUX) | 210 #endif // defined(OS_LINUX) |
| 205 return true; | 211 return update_client::CrxInstaller::Result(update_client::InstallError::NONE); |
| 206 } | 212 } |
| 207 | 213 |
| 208 void FlashComponentInstallerTraits::ComponentReady( | 214 void FlashComponentInstallerTraits::ComponentReady( |
| 209 const base::Version& version, | 215 const base::Version& version, |
| 210 const base::FilePath& path, | 216 const base::FilePath& path, |
| 211 std::unique_ptr<base::DictionaryValue> manifest) { | 217 std::unique_ptr<base::DictionaryValue> manifest) { |
| 212 #if !defined(OS_LINUX) | 218 #if !defined(OS_LINUX) |
| 213 // Installation is done. Now tell the rest of chrome. Both the path service | 219 // Installation is done. Now tell the rest of chrome. Both the path service |
| 214 // and to the plugin service. On Linux, a restart is required to use the new | 220 // and to the plugin service. On Linux, a restart is required to use the new |
| 215 // Flash version, so we do not do this. | 221 // Flash version, so we do not do this. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 std::unique_ptr<ComponentInstallerTraits> traits( | 272 std::unique_ptr<ComponentInstallerTraits> traits( |
| 267 new FlashComponentInstallerTraits); | 273 new FlashComponentInstallerTraits); |
| 268 // |cus| will take ownership of |installer| during installer->Register(cus). | 274 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 269 DefaultComponentInstaller* installer = | 275 DefaultComponentInstaller* installer = |
| 270 new DefaultComponentInstaller(std::move(traits)); | 276 new DefaultComponentInstaller(std::move(traits)); |
| 271 installer->Register(cus, base::Closure()); | 277 installer->Register(cus, base::Closure()); |
| 272 #endif // defined(GOOGLE_CHROME_BUILD) | 278 #endif // defined(GOOGLE_CHROME_BUILD) |
| 273 } | 279 } |
| 274 | 280 |
| 275 } // namespace component_updater | 281 } // namespace component_updater |
| OLD | NEW |