| 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> |
| 11 #include <utility> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/base_paths.h" | 14 #include "base/base_paths.h" |
| 14 #include "base/bind.h" | 15 #include "base/bind.h" |
| 15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 16 #include "base/files/file_enumerator.h" | 17 #include "base/files/file_enumerator.h" |
| 17 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 18 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
| 19 #include "base/json/json_reader.h" | 20 #include "base/json/json_reader.h" |
| 20 #include "base/logging.h" | 21 #include "base/logging.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 const base::FilePath& install_dir) override; | 181 const base::FilePath& install_dir) override; |
| 181 bool VerifyInstallation(const base::DictionaryValue& manifest, | 182 bool VerifyInstallation(const base::DictionaryValue& manifest, |
| 182 const base::FilePath& install_dir) const override; | 183 const base::FilePath& install_dir) const override; |
| 183 void ComponentReady(const base::Version& version, | 184 void ComponentReady(const base::Version& version, |
| 184 const base::FilePath& path, | 185 const base::FilePath& path, |
| 185 std::unique_ptr<base::DictionaryValue> manifest) override; | 186 std::unique_ptr<base::DictionaryValue> manifest) override; |
| 186 base::FilePath GetRelativeInstallDir() const override; | 187 base::FilePath GetRelativeInstallDir() const override; |
| 187 void GetHash(std::vector<uint8_t>* hash) const override; | 188 void GetHash(std::vector<uint8_t>* hash) const override; |
| 188 std::string GetName() const override; | 189 std::string GetName() const override; |
| 189 update_client::InstallerAttributes GetInstallerAttributes() const override; | 190 update_client::InstallerAttributes GetInstallerAttributes() const override; |
| 191 std::vector<std::string> GetMimeTypes() const override; |
| 190 | 192 |
| 191 DISALLOW_COPY_AND_ASSIGN(FlashComponentInstallerTraits); | 193 DISALLOW_COPY_AND_ASSIGN(FlashComponentInstallerTraits); |
| 192 }; | 194 }; |
| 193 | 195 |
| 194 FlashComponentInstallerTraits::FlashComponentInstallerTraits() {} | 196 FlashComponentInstallerTraits::FlashComponentInstallerTraits() {} |
| 195 | 197 |
| 196 bool FlashComponentInstallerTraits::CanAutoUpdate() const { | 198 bool FlashComponentInstallerTraits::CanAutoUpdate() const { |
| 197 return true; | 199 return true; |
| 198 } | 200 } |
| 199 | 201 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 255 } |
| 254 | 256 |
| 255 std::string FlashComponentInstallerTraits::GetName() const { | 257 std::string FlashComponentInstallerTraits::GetName() const { |
| 256 return "pepper_flash"; | 258 return "pepper_flash"; |
| 257 } | 259 } |
| 258 | 260 |
| 259 update_client::InstallerAttributes | 261 update_client::InstallerAttributes |
| 260 FlashComponentInstallerTraits::GetInstallerAttributes() const { | 262 FlashComponentInstallerTraits::GetInstallerAttributes() const { |
| 261 return update_client::InstallerAttributes(); | 263 return update_client::InstallerAttributes(); |
| 262 } | 264 } |
| 265 |
| 266 std::vector<std::string> FlashComponentInstallerTraits::GetMimeTypes() const { |
| 267 std::vector<std::string> mime_types; |
| 268 mime_types.push_back("application/x-shockwave-flash"); |
| 269 mime_types.push_back("application/futuresplash"); |
| 270 return mime_types; |
| 271 } |
| 263 #endif // defined(GOOGLE_CHROME_BUILD) | 272 #endif // defined(GOOGLE_CHROME_BUILD) |
| 264 | 273 |
| 265 } // namespace | 274 } // namespace |
| 266 | 275 |
| 267 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { | 276 void RegisterPepperFlashComponent(ComponentUpdateService* cus) { |
| 268 #if defined(GOOGLE_CHROME_BUILD) | 277 #if defined(GOOGLE_CHROME_BUILD) |
| 269 // Component updated flash supersedes bundled flash therefore if that one | 278 // Component updated flash supersedes bundled flash therefore if that one |
| 270 // is disabled then this one should never install. | 279 // is disabled then this one should never install. |
| 271 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 280 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 272 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) | 281 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) |
| 273 return; | 282 return; |
| 274 std::unique_ptr<ComponentInstallerTraits> traits( | 283 std::unique_ptr<ComponentInstallerTraits> traits( |
| 275 new FlashComponentInstallerTraits); | 284 new FlashComponentInstallerTraits); |
| 276 // |cus| will take ownership of |installer| during installer->Register(cus). | 285 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 277 DefaultComponentInstaller* installer = | 286 DefaultComponentInstaller* installer = |
| 278 new DefaultComponentInstaller(std::move(traits)); | 287 new DefaultComponentInstaller(std::move(traits)); |
| 279 installer->Register(cus, base::Closure()); | 288 installer->Register(cus, base::Closure()); |
| 280 #endif // defined(GOOGLE_CHROME_BUILD) | 289 #endif // defined(GOOGLE_CHROME_BUILD) |
| 281 } | 290 } |
| 282 | 291 |
| 283 } // namespace component_updater | 292 } // namespace component_updater |
| OLD | NEW |