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

Side by Side Diff: chrome/browser/metrics/metrics_log.cc

Issue 312583002: Move MetricsStateManager into the Metrics component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/metrics/metrics_log.h" 5 #include "chrome/browser/metrics/metrics_log.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace { 46 namespace {
47 47
48 // Returns the date at which the current metrics client ID was created as 48 // Returns the date at which the current metrics client ID was created as
49 // a string containing seconds since the epoch, or "0" if none was found. 49 // a string containing seconds since the epoch, or "0" if none was found.
50 std::string GetMetricsEnabledDate(PrefService* pref) { 50 std::string GetMetricsEnabledDate(PrefService* pref) {
51 if (!pref) { 51 if (!pref) {
52 NOTREACHED(); 52 NOTREACHED();
53 return "0"; 53 return "0";
54 } 54 }
55 55
56 return pref->GetString(prefs::kMetricsReportingEnabledTimestamp); 56 return pref->GetString(metrics::prefs::kMetricsReportingEnabledTimestamp);
57 } 57 }
58 58
59 // Computes a SHA-1 hash of |data| and returns it as a hex string. 59 // Computes a SHA-1 hash of |data| and returns it as a hex string.
60 std::string ComputeSHA1(const std::string& data) { 60 std::string ComputeSHA1(const std::string& data) {
61 const std::string sha1 = base::SHA1HashString(data); 61 const std::string sha1 = base::SHA1HashString(data);
62 return base::HexEncode(sha1.data(), sha1.size()); 62 return base::HexEncode(sha1.data(), sha1.size());
63 } 63 }
64 64
65 void WriteFieldTrials(const std::vector<ActiveGroupId>& field_trial_ids, 65 void WriteFieldTrials(const std::vector<ActiveGroupId>& field_trial_ids,
66 SystemProfileProto* system_profile) { 66 SystemProfileProto* system_profile) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 local_state->ClearPref(prefs::kStabilitySavedSystemProfile); 305 local_state->ClearPref(prefs::kStabilitySavedSystemProfile);
306 local_state->ClearPref(prefs::kStabilitySavedSystemProfileHash); 306 local_state->ClearPref(prefs::kStabilitySavedSystemProfileHash);
307 307
308 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile(); 308 SystemProfileProto* system_profile = uma_proto()->mutable_system_profile();
309 std::string serialied_system_profile; 309 std::string serialied_system_profile;
310 return base::Base64Decode(base64_system_profile, &serialied_system_profile) && 310 return base::Base64Decode(base64_system_profile, &serialied_system_profile) &&
311 ComputeSHA1(serialied_system_profile) == system_profile_hash && 311 ComputeSHA1(serialied_system_profile) == system_profile_hash &&
312 system_profile->ParseFromString(serialied_system_profile); 312 system_profile->ParseFromString(serialied_system_profile);
313 } 313 }
314 314
OLDNEW
« no previous file with comments | « chrome/browser/metrics/extensions_metrics_provider_unittest.cc ('k') | chrome/browser/metrics/metrics_log_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698