| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 reporter_key.DeleteValue(kFoundUwsValueName); | 283 reporter_key.DeleteValue(kFoundUwsValueName); |
| 284 | 284 |
| 285 UMA_HISTOGRAM_BOOLEAN(kFoundUwsReadErrorMetricName, parse_error); | 285 UMA_HISTOGRAM_BOOLEAN(kFoundUwsReadErrorMetricName, parse_error); |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 class SwReporterInstallerTraits : public ComponentInstallerTraits { | 289 class SwReporterInstallerTraits : public ComponentInstallerTraits { |
| 290 public: | 290 public: |
| 291 explicit SwReporterInstallerTraits(PrefService* prefs) : prefs_(prefs) {} | 291 explicit SwReporterInstallerTraits(PrefService* prefs) : prefs_(prefs) {} |
| 292 | 292 |
| 293 virtual ~SwReporterInstallerTraits() {} | 293 ~SwReporterInstallerTraits() override {} |
| 294 | 294 |
| 295 virtual bool VerifyInstallation(const base::DictionaryValue& manifest, | 295 bool VerifyInstallation(const base::DictionaryValue& manifest, |
| 296 const base::FilePath& dir) const { | 296 const base::FilePath& dir) const override { |
| 297 return base::PathExists(dir.Append(kSwReporterExeName)); | 297 return base::PathExists(dir.Append(kSwReporterExeName)); |
| 298 } | 298 } |
| 299 | 299 |
| 300 virtual bool CanAutoUpdate() const { return true; } | 300 bool CanAutoUpdate() const override { return true; } |
| 301 | 301 |
| 302 virtual bool OnCustomInstall(const base::DictionaryValue& manifest, | 302 bool OnCustomInstall(const base::DictionaryValue& manifest, |
| 303 const base::FilePath& install_dir) { | 303 const base::FilePath& install_dir) override { |
| 304 return true; | 304 return true; |
| 305 } | 305 } |
| 306 | 306 |
| 307 virtual void ComponentReady(const base::Version& version, | 307 void ComponentReady(const base::Version& version, |
| 308 const base::FilePath& install_dir, | 308 const base::FilePath& install_dir, |
| 309 scoped_ptr<base::DictionaryValue> manifest) { | 309 scoped_ptr<base::DictionaryValue> manifest) override { |
| 310 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 310 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 311 ReportVersionWithUma(version); | 311 ReportVersionWithUma(version); |
| 312 | 312 |
| 313 wcsncpy_s(version_dir_, | 313 wcsncpy_s(version_dir_, |
| 314 _MAX_PATH, | 314 _MAX_PATH, |
| 315 install_dir.value().c_str(), | 315 install_dir.value().c_str(), |
| 316 install_dir.value().size()); | 316 install_dir.value().size()); |
| 317 | 317 |
| 318 // A previous run may have results in the registry, so check and report | 318 // A previous run may have results in the registry, so check and report |
| 319 // them if present. | 319 // them if present. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 345 | 345 |
| 346 base::WorkerPool::PostTask( | 346 base::WorkerPool::PostTask( |
| 347 FROM_HERE, | 347 FROM_HERE, |
| 348 base::Bind(&LaunchAndWaitForExit, | 348 base::Bind(&LaunchAndWaitForExit, |
| 349 install_dir.Append(kSwReporterExeName), | 349 install_dir.Append(kSwReporterExeName), |
| 350 version_string), | 350 version_string), |
| 351 true); | 351 true); |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 | 354 |
| 355 virtual base::FilePath GetBaseDirectory() const { return install_dir(); } | 355 base::FilePath GetBaseDirectory() const override { return install_dir(); } |
| 356 | 356 |
| 357 virtual void GetHash(std::vector<uint8_t>* hash) const { GetPkHash(hash); } | 357 void GetHash(std::vector<uint8_t>* hash) const override { GetPkHash(hash); } |
| 358 | 358 |
| 359 virtual std::string GetName() const { return "Software Reporter Tool"; } | 359 std::string GetName() const override { return "Software Reporter Tool"; } |
| 360 | 360 |
| 361 static base::FilePath install_dir() { | 361 static base::FilePath install_dir() { |
| 362 // The base directory on windows looks like: | 362 // The base directory on windows looks like: |
| 363 // <profile>\AppData\Local\Google\Chrome\User Data\SwReporter\. | 363 // <profile>\AppData\Local\Google\Chrome\User Data\SwReporter\. |
| 364 base::FilePath result; | 364 base::FilePath result; |
| 365 PathService::Get(DIR_SW_REPORTER, &result); | 365 PathService::Get(DIR_SW_REPORTER, &result); |
| 366 return result; | 366 return result; |
| 367 } | 367 } |
| 368 | 368 |
| 369 static std::string ID() { | 369 static std::string ID() { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 void RegisterProfilePrefsForSwReporter( | 475 void RegisterProfilePrefsForSwReporter( |
| 476 user_prefs::PrefRegistrySyncable* registry) { | 476 user_prefs::PrefRegistrySyncable* registry) { |
| 477 registry->RegisterIntegerPref(prefs::kSwReporterPromptReason, -1); | 477 registry->RegisterIntegerPref(prefs::kSwReporterPromptReason, -1); |
| 478 | 478 |
| 479 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); | 479 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); |
| 480 | 480 |
| 481 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); | 481 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); |
| 482 } | 482 } |
| 483 | 483 |
| 484 } // namespace component_updater | 484 } // namespace component_updater |
| OLD | NEW |