Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1973)

Unified Diff: chrome/browser/component_updater/cld_component_installer.cc

Issue 334783002: Componentize component_updater: Move some paths/constants to component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge origin/master Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/component_updater/cld_component_installer.cc
diff --git a/chrome/browser/component_updater/cld_component_installer.cc b/chrome/browser/component_updater/cld_component_installer.cc
index 3ec1f595e63dec2dfdbf71ac4ce59db7796bc49d..63b5f6f62beffe04dd3eb9474a2164bf4544f6ce 100644
--- a/chrome/browser/component_updater/cld_component_installer.cc
+++ b/chrome/browser/component_updater/cld_component_installer.cc
@@ -12,11 +12,8 @@
#include "base/files/file_path.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/path_service.h"
#include "base/platform_file.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
+#include "base/values.h"
#include "content/public/browser/browser_thread.h"
#include "net/ssl/ssl_config_service.h"
@@ -47,7 +44,10 @@ const uint8 kPublicKeySHA256[32] = {
const char kCldManifestName[] = "CLD2 Data";
-CldComponentInstallerTraits::CldComponentInstallerTraits() {
+CldComponentInstallerTraits::CldComponentInstallerTraits(
+ const base::FilePath& base_dir,
+ const base::FilePath& data_filename)
+ : base_dir_(base_dir), data_filename_(data_filename) {
}
bool CldComponentInstallerTraits::CanAutoUpdate() const {
@@ -61,13 +61,13 @@ bool CldComponentInstallerTraits::OnCustomInstall(
}
base::FilePath CldComponentInstallerTraits::GetInstalledPath(
- const base::FilePath& base) {
+ const base::FilePath& base) const {
// Currently, all platforms have the file at the same location because there
// is no binary difference in the generated file on any supported platform.
// NB: This may change when 64-bit is officially supported.
return base.Append(FILE_PATH_LITERAL("_platform_specific"))
.Append(FILE_PATH_LITERAL("all"))
- .Append(chrome::kCLDDataFilename);
+ .Append(data_filename_);
}
void CldComponentInstallerTraits::ComponentReady(
@@ -92,9 +92,7 @@ bool CldComponentInstallerTraits::VerifyInstallation(
}
base::FilePath CldComponentInstallerTraits::GetBaseDirectory() const {
- base::FilePath result;
- PathService::Get(chrome::DIR_COMPONENT_CLD2, &result);
- return result;
+ return base_dir_;
}
void CldComponentInstallerTraits::GetHash(std::vector<uint8>* hash) const {
@@ -106,9 +104,11 @@ std::string CldComponentInstallerTraits::GetName() const {
return kCldManifestName;
}
-void RegisterCldComponent(ComponentUpdateService* cus) {
+void RegisterCldComponent(ComponentUpdateService* cus,
+ const base::FilePath& base_dir,
+ const base::FilePath& data_filename) {
scoped_ptr<ComponentInstallerTraits> traits(
- new CldComponentInstallerTraits());
+ new CldComponentInstallerTraits(base_dir, data_filename));
// |cus| will take ownership of |installer| during installer->Register(cus).
DefaultComponentInstaller* installer =
new DefaultComponentInstaller(traits.Pass());

Powered by Google App Engine
This is Rietveld 408576698