| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/sw_reporter_installer_win.h" | 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 void ComponentReady( | 125 void ComponentReady( |
| 126 const base::Version& version, | 126 const base::Version& version, |
| 127 const base::FilePath& install_dir, | 127 const base::FilePath& install_dir, |
| 128 std::unique_ptr<base::DictionaryValue> manifest) override { | 128 std::unique_ptr<base::DictionaryValue> manifest) override { |
| 129 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 129 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 130 safe_browsing::RunSwReporter(install_dir.Append(kSwReporterExeName), | 130 safe_browsing::RunSwReporter(install_dir.Append(kSwReporterExeName), |
| 131 version, base::ThreadTaskRunnerHandle::Get(), | 131 version, base::ThreadTaskRunnerHandle::Get(), |
| 132 base::WorkerPool::GetTaskRunner(true)); | 132 base::WorkerPool::GetTaskRunner(true)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 base::FilePath GetBaseDirectory() const override { return install_dir(); } | 135 base::FilePath GetRelativeInstallDir() const override { |
| 136 return base::FilePath(FILE_PATH_LITERAL("SwReporter")); |
| 137 } |
| 136 | 138 |
| 137 void GetHash(std::vector<uint8_t>* hash) const override { GetPkHash(hash); } | 139 void GetHash(std::vector<uint8_t>* hash) const override { GetPkHash(hash); } |
| 138 | 140 |
| 139 std::string GetName() const override { return "Software Reporter Tool"; } | 141 std::string GetName() const override { return "Software Reporter Tool"; } |
| 140 | 142 |
| 141 std::string GetAp() const override { return std::string(); } | 143 std::string GetAp() const override { return std::string(); } |
| 142 | 144 |
| 143 static base::FilePath install_dir() { | |
| 144 // The base directory on windows looks like: | |
| 145 // <profile>\AppData\Local\Google\Chrome\User Data\SwReporter\. | |
| 146 base::FilePath result; | |
| 147 PathService::Get(DIR_SW_REPORTER, &result); | |
| 148 return result; | |
| 149 } | |
| 150 | |
| 151 static std::string ID() { | 145 static std::string ID() { |
| 152 update_client::CrxComponent component; | 146 update_client::CrxComponent component; |
| 153 component.version = Version("0.0.0.0"); | 147 component.version = Version("0.0.0.0"); |
| 154 GetPkHash(&component.pk_hash); | 148 GetPkHash(&component.pk_hash); |
| 155 return update_client::GetCrxComponentID(component); | 149 return update_client::GetCrxComponentID(component); |
| 156 } | 150 } |
| 157 | 151 |
| 158 private: | 152 private: |
| 159 static void GetPkHash(std::vector<uint8_t>* hash) { | 153 static void GetPkHash(std::vector<uint8_t>* hash) { |
| 160 DCHECK(hash); | 154 DCHECK(hash); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 250 } |
| 257 | 251 |
| 258 void RegisterProfilePrefsForSwReporter( | 252 void RegisterProfilePrefsForSwReporter( |
| 259 user_prefs::PrefRegistrySyncable* registry) { | 253 user_prefs::PrefRegistrySyncable* registry) { |
| 260 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); | 254 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); |
| 261 | 255 |
| 262 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); | 256 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); |
| 263 } | 257 } |
| 264 | 258 |
| 265 } // namespace component_updater | 259 } // namespace component_updater |
| OLD | NEW |