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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 uint32_t minor_version = 0; | 114 uint32_t minor_version = 0; |
115 if (version.components().size() > 1) | 115 if (version.components().size() > 1) |
116 minor_version = version.components()[version.components().size() - 2]; | 116 minor_version = version.components()[version.components().size() - 2]; |
117 else | 117 else |
118 minor_version = version.components()[0]; | 118 minor_version = version.components()[0]; |
119 UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.MinorVersion", minor_version); | 119 UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.MinorVersion", minor_version); |
120 | 120 |
121 // The major version for X.Y.Z is X*256^3+Y*256+Z. If there are additional | 121 // The major version for X.Y.Z is X*256^3+Y*256+Z. If there are additional |
122 // components, only the first three count, and if there are less than 3, the | 122 // components, only the first three count, and if there are less than 3, the |
123 // missing values are just replaced by zero. So 1 is equivalent 1.0.0. | 123 // missing values are just replaced by zero. So 1 is equivalent 1.0.0. |
124 DCHECK_LT(version.components()[0], 0x100); | 124 DCHECK_LT(version.components()[0], 0x100U); |
125 uint32_t major_version = 0x1000000 * version.components()[0]; | 125 uint32_t major_version = 0x1000000 * version.components()[0]; |
126 if (version.components().size() >= 2) { | 126 if (version.components().size() >= 2) { |
127 DCHECK_LT(version.components()[1], 0x10000); | 127 DCHECK_LT(version.components()[1], 0x10000U); |
128 major_version += 0x100 * version.components()[1]; | 128 major_version += 0x100 * version.components()[1]; |
129 } | 129 } |
130 if (version.components().size() >= 3) { | 130 if (version.components().size() >= 3) { |
131 DCHECK_LT(version.components()[2], 0x100); | 131 DCHECK_LT(version.components()[2], 0x100U); |
132 major_version += version.components()[2]; | 132 major_version += version.components()[2]; |
133 } | 133 } |
134 UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.MajorVersion", major_version); | 134 UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.MajorVersion", major_version); |
135 } | 135 } |
136 | 136 |
137 void ReportUploadsWithUma(const base::string16& upload_results) { | 137 void ReportUploadsWithUma(const base::string16& upload_results) { |
138 base::WStringTokenizer tokenizer(upload_results, L";"); | 138 base::WStringTokenizer tokenizer(upload_results, L";"); |
139 int failure_count = 0; | 139 int failure_count = 0; |
140 int success_count = 0; | 140 int success_count = 0; |
141 int longest_failure_run = 0; | 141 int longest_failure_run = 0; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 registry->RegisterStringPref( | 439 registry->RegisterStringPref( |
440 prefs::kSwReporterPromptVersion, "", | 440 prefs::kSwReporterPromptVersion, "", |
441 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 441 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
442 | 442 |
443 registry->RegisterStringPref( | 443 registry->RegisterStringPref( |
444 prefs::kSwReporterPromptSeed, "", | 444 prefs::kSwReporterPromptSeed, "", |
445 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 445 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
446 } | 446 } |
447 | 447 |
448 } // namespace component_updater | 448 } // namespace component_updater |
OLD | NEW |