| 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 <string.h> | 5 #include <string.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "base/version.h" | 23 #include "base/version.h" |
| 24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
| 25 #include "chrome/browser/component_updater/component_updater_service.h" | 25 #include "chrome/browser/component_updater/component_updater_service.h" |
| 26 #include "chrome/browser/component_updater/flash_component_installer.h" | 26 #include "chrome/browser/component_updater/flash_component_installer.h" |
| 27 #include "chrome/browser/component_updater/ppapi_utils.h" | 27 #include "chrome/browser/component_updater/ppapi_utils.h" |
| 28 #include "chrome/browser/plugins/plugin_prefs.h" | 28 #include "chrome/browser/plugins/plugin_prefs.h" |
| 29 #include "chrome/common/chrome_constants.h" | |
| 30 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/chrome_switches.h" | 30 #include "components/component_updater/component_updater_constants.h" |
| 32 #include "chrome/common/pepper_flash.h" | 31 #include "components/component_updater/component_updater_switches.h" |
| 32 #include "components/component_updater/pepper_flash.h" |
| 33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/plugin_service.h" | 34 #include "content/public/browser/plugin_service.h" |
| 35 #include "content/public/common/content_constants.h" | 35 #include "content/public/common/content_constants.h" |
| 36 #include "content/public/common/pepper_plugin_info.h" | 36 #include "content/public/common/pepper_plugin_info.h" |
| 37 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. NOLINT | 37 #include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR. NOLINT |
| 38 #include "ppapi/c/private/ppb_pdf.h" | 38 #include "ppapi/c/private/ppb_pdf.h" |
| 39 #include "ppapi/shared_impl/ppapi_permissions.h" | 39 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 40 | 40 |
| 41 using content::BrowserThread; | 41 using content::BrowserThread; |
| 42 using content::PluginService; | 42 using content::PluginService; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 | 360 |
| 361 bool PepperFlashComponentInstaller::Install( | 361 bool PepperFlashComponentInstaller::Install( |
| 362 const base::DictionaryValue& manifest, | 362 const base::DictionaryValue& manifest, |
| 363 const base::FilePath& unpack_path) { | 363 const base::FilePath& unpack_path) { |
| 364 Version version; | 364 Version version; |
| 365 if (!CheckPepperFlashManifest(manifest, &version)) | 365 if (!CheckPepperFlashManifest(manifest, &version)) |
| 366 return false; | 366 return false; |
| 367 if (current_version_.CompareTo(version) > 0) | 367 if (current_version_.CompareTo(version) > 0) |
| 368 return false; | 368 return false; |
| 369 if (!base::PathExists(unpack_path.Append(chrome::kPepperFlashPluginFilename))) | 369 if (!base::PathExists(unpack_path.Append( |
| 370 component_updater::kPepperFlashPluginFilename))) { |
| 370 return false; | 371 return false; |
| 372 } |
| 371 // Passed the basic tests. Time to install it. | 373 // Passed the basic tests. Time to install it. |
| 372 base::FilePath path = | 374 base::FilePath path = |
| 373 GetPepperFlashBaseDirectory().AppendASCII(version.GetString()); | 375 GetPepperFlashBaseDirectory().AppendASCII(version.GetString()); |
| 374 if (base::PathExists(path)) | 376 if (base::PathExists(path)) |
| 375 return false; | 377 return false; |
| 376 if (!base::Move(unpack_path, path)) | 378 if (!base::Move(unpack_path, path)) |
| 377 return false; | 379 return false; |
| 378 // Installation is done. Now tell the rest of chrome. Both the path service | 380 // Installation is done. Now tell the rest of chrome. Both the path service |
| 379 // and to the plugin service. | 381 // and to the plugin service. |
| 380 current_version_ = version; | 382 current_version_ = version; |
| 381 PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path); | 383 PathService::Override(chrome::DIR_PEPPER_FLASH_PLUGIN, path); |
| 382 path = path.Append(chrome::kPepperFlashPluginFilename); | 384 path = path.Append(component_updater::kPepperFlashPluginFilename); |
| 383 BrowserThread::PostTask( | 385 BrowserThread::PostTask( |
| 384 BrowserThread::UI, | 386 BrowserThread::UI, |
| 385 FROM_HERE, | 387 FROM_HERE, |
| 386 base::Bind(&RegisterPepperFlashWithChrome, path, version, false)); | 388 base::Bind(&RegisterPepperFlashWithChrome, path, version, false)); |
| 387 return true; | 389 return true; |
| 388 } | 390 } |
| 389 | 391 |
| 390 bool PepperFlashComponentInstaller::GetInstalledFile( | 392 bool PepperFlashComponentInstaller::GetInstalledFile( |
| 391 const std::string& file, | 393 const std::string& file, |
| 392 base::FilePath* installed_file) { | 394 base::FilePath* installed_file) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 509 CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 508 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) | 510 if (cmd_line->HasSwitch(switches::kDisableBundledPpapiFlash)) |
| 509 return; | 511 return; |
| 510 BrowserThread::PostTask(BrowserThread::FILE, | 512 BrowserThread::PostTask(BrowserThread::FILE, |
| 511 FROM_HERE, | 513 FROM_HERE, |
| 512 base::Bind(&StartPepperFlashUpdateRegistration, cus)); | 514 base::Bind(&StartPepperFlashUpdateRegistration, cus)); |
| 513 #endif | 515 #endif |
| 514 } | 516 } |
| 515 | 517 |
| 516 } // namespace component_updater | 518 } // namespace component_updater |
| OLD | NEW |