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

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

Issue 10540003: Move guid generation from chrome/common/ to base/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: installer Created 8 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 //------------------------------------------------------------------------------ 5 //------------------------------------------------------------------------------
6 // Description of the life cycle of a instance of MetricsService. 6 // Description of the life cycle of a instance of MetricsService.
7 // 7 //
8 // OVERVIEW 8 // OVERVIEW
9 // 9 //
10 // A MetricsService instance is typically created at application startup. It 10 // A MetricsService instance is typically created at application startup. It
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // the external server, and the user shuts down, then a copy of the log may be 138 // the external server, and the user shuts down, then a copy of the log may be
139 // saved for re-transmission. These duplicates could be filtered out server 139 // saved for re-transmission. These duplicates could be filtered out server
140 // side, but are not expected to be a significant problem. 140 // side, but are not expected to be a significant problem.
141 // 141 //
142 // 142 //
143 //------------------------------------------------------------------------------ 143 //------------------------------------------------------------------------------
144 144
145 #include "chrome/browser/metrics/metrics_service.h" 145 #include "chrome/browser/metrics/metrics_service.h"
146 146
147 #include "base/bind.h" 147 #include "base/bind.h"
148 #include "base/guid.h"
148 #include "base/callback.h" 149 #include "base/callback.h"
149 #include "base/command_line.h" 150 #include "base/command_line.h"
150 #include "base/md5.h" 151 #include "base/md5.h"
151 #include "base/metrics/histogram.h" 152 #include "base/metrics/histogram.h"
152 #include "base/rand_util.h" 153 #include "base/rand_util.h"
153 #include "base/string_number_conversions.h" 154 #include "base/string_number_conversions.h"
154 #include "base/threading/platform_thread.h" 155 #include "base/threading/platform_thread.h"
155 #include "base/threading/thread.h" 156 #include "base/threading/thread.h"
156 #include "base/threading/thread_restrictions.h" 157 #include "base/threading/thread_restrictions.h"
157 #include "base/tracked_objects.h" 158 #include "base/tracked_objects.h"
(...skipping 13 matching lines...) Expand all
171 #include "chrome/browser/net/http_pipelining_compatibility_client.h" 172 #include "chrome/browser/net/http_pipelining_compatibility_client.h"
172 #include "chrome/browser/net/network_stats.h" 173 #include "chrome/browser/net/network_stats.h"
173 #include "chrome/browser/prefs/pref_service.h" 174 #include "chrome/browser/prefs/pref_service.h"
174 #include "chrome/browser/prefs/scoped_user_pref_update.h" 175 #include "chrome/browser/prefs/scoped_user_pref_update.h"
175 #include "chrome/browser/profiles/profile.h" 176 #include "chrome/browser/profiles/profile.h"
176 #include "chrome/browser/search_engines/template_url_service.h" 177 #include "chrome/browser/search_engines/template_url_service.h"
177 #include "chrome/browser/ui/browser_list.h" 178 #include "chrome/browser/ui/browser_list.h"
178 #include "chrome/common/child_process_logging.h" 179 #include "chrome/common/child_process_logging.h"
179 #include "chrome/common/chrome_notification_types.h" 180 #include "chrome/common/chrome_notification_types.h"
180 #include "chrome/common/chrome_switches.h" 181 #include "chrome/common/chrome_switches.h"
181 #include "chrome/common/guid.h"
182 #include "chrome/common/metrics/metrics_log_manager.h" 182 #include "chrome/common/metrics/metrics_log_manager.h"
183 #include "chrome/common/net/test_server_locations.h" 183 #include "chrome/common/net/test_server_locations.h"
184 #include "chrome/common/pref_names.h" 184 #include "chrome/common/pref_names.h"
185 #include "chrome/common/render_messages.h" 185 #include "chrome/common/render_messages.h"
186 #include "content/public/browser/child_process_data.h" 186 #include "content/public/browser/child_process_data.h"
187 #include "content/public/browser/load_notification_details.h" 187 #include "content/public/browser/load_notification_details.h"
188 #include "content/public/browser/notification_service.h" 188 #include "content/public/browser/notification_service.h"
189 #include "content/public/browser/plugin_service.h" 189 #include "content/public/browser/plugin_service.h"
190 #include "content/public/browser/render_process_host.h" 190 #include "content/public/browser/render_process_host.h"
191 #include "content/public/common/url_fetcher.h" 191 #include "content/public/common/url_fetcher.h"
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 } 907 }
908 908
909 low_entropy_source_ = GenerateLowEntropySource(); 909 low_entropy_source_ = GenerateLowEntropySource();
910 pref->SetInteger(prefs::kMetricsLowEntropySource, low_entropy_source_); 910 pref->SetInteger(prefs::kMetricsLowEntropySource, low_entropy_source_);
911 911
912 return low_entropy_source_; 912 return low_entropy_source_;
913 } 913 }
914 914
915 // static 915 // static
916 std::string MetricsService::GenerateClientID() { 916 std::string MetricsService::GenerateClientID() {
917 return guid::GenerateGUID(); 917 return base::GenerateGUID();
918 } 918 }
919 919
920 //------------------------------------------------------------------------------ 920 //------------------------------------------------------------------------------
921 // State save methods 921 // State save methods
922 922
923 void MetricsService::ScheduleNextStateSave() { 923 void MetricsService::ScheduleNextStateSave() {
924 state_saver_factory_.InvalidateWeakPtrs(); 924 state_saver_factory_.InvalidateWeakPtrs();
925 925
926 MessageLoop::current()->PostDelayedTask(FROM_HERE, 926 MessageLoop::current()->PostDelayedTask(FROM_HERE,
927 base::Bind(&MetricsService::SaveLocalState, 927 base::Bind(&MetricsService::SaveLocalState,
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 if (local_state) { 1745 if (local_state) {
1746 const PrefService::Preference* uma_pref = 1746 const PrefService::Preference* uma_pref =
1747 local_state->FindPreference(prefs::kMetricsReportingEnabled); 1747 local_state->FindPreference(prefs::kMetricsReportingEnabled);
1748 if (uma_pref) { 1748 if (uma_pref) {
1749 bool success = uma_pref->GetValue()->GetAsBoolean(&result); 1749 bool success = uma_pref->GetValue()->GetAsBoolean(&result);
1750 DCHECK(success); 1750 DCHECK(success);
1751 } 1751 }
1752 } 1752 }
1753 return result; 1753 return result;
1754 } 1754 }
OLDNEW
« no previous file with comments | « chrome/browser/history/shortcuts_database_unittest.cc ('k') | chrome/browser/policy/auto_enrollment_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698