OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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/metrics/chrome_metrics_service_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "chrome/browser/metrics/omnibox_metrics_provider.h" | 28 #include "chrome/browser/metrics/omnibox_metrics_provider.h" |
29 #include "chrome/browser/metrics/profiler_metrics_provider.h" | 29 #include "chrome/browser/metrics/profiler_metrics_provider.h" |
30 #include "chrome/browser/metrics/tracking_synchronizer.h" | 30 #include "chrome/browser/metrics/tracking_synchronizer.h" |
31 #include "chrome/browser/ui/browser_otr_state.h" | 31 #include "chrome/browser/ui/browser_otr_state.h" |
32 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
35 #include "chrome/common/crash_keys.h" | 35 #include "chrome/common/crash_keys.h" |
36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
37 #include "chrome/common/render_messages.h" | 37 #include "chrome/common/render_messages.h" |
38 #include "chrome/installer/util/google_update_settings.h" | |
38 #include "components/metrics/metrics_service.h" | 39 #include "components/metrics/metrics_service.h" |
39 #include "components/metrics/net/net_metrics_log_uploader.h" | 40 #include "components/metrics/net/net_metrics_log_uploader.h" |
40 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
41 #include "content/public/browser/histogram_fetcher.h" | 42 #include "content/public/browser/histogram_fetcher.h" |
42 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
43 #include "content/public/browser/render_process_host.h" | 44 #include "content/public/browser/render_process_host.h" |
44 | 45 |
45 #if defined(OS_ANDROID) | 46 #if defined(OS_ANDROID) |
46 #include "chrome/browser/metrics/android_metrics_provider.h" | 47 #include "chrome/browser/metrics/android_metrics_provider.h" |
47 #else | 48 #else |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 // receives pointers to fully constructed objects. | 140 // receives pointers to fully constructed objects. |
140 scoped_ptr<ChromeMetricsServiceClient> client( | 141 scoped_ptr<ChromeMetricsServiceClient> client( |
141 new ChromeMetricsServiceClient(state_manager)); | 142 new ChromeMetricsServiceClient(state_manager)); |
142 client->Initialize(); | 143 client->Initialize(); |
143 | 144 |
144 return client.Pass(); | 145 return client.Pass(); |
145 } | 146 } |
146 | 147 |
147 // static | 148 // static |
148 void ChromeMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { | 149 void ChromeMetricsServiceClient::RegisterPrefs(PrefRegistrySimple* registry) { |
149 registry->RegisterInt64Pref(metrics::prefs::kInstallDate, 0); | 150 registry->RegisterInt64Pref(metrics::prefs::kInstallDate, 0); |
Ilya Sherman
2014/07/08 23:41:37
Looks like your other change got mixed into this o
gab
2014/07/08 23:56:44
It's based on top of it locally, hence why you see
Ilya Sherman
2014/07/09 00:00:14
Sorry, I was looking at the side-by-side view, whi
| |
150 registry->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0); | 151 registry->RegisterInt64Pref(prefs::kUninstallLastLaunchTimeSec, 0); |
151 registry->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0); | 152 registry->RegisterInt64Pref(prefs::kUninstallLastObservedRunTimeSec, 0); |
152 | 153 |
153 MetricsService::RegisterPrefs(registry); | 154 MetricsService::RegisterPrefs(registry); |
154 ChromeStabilityMetricsProvider::RegisterPrefs(registry); | 155 ChromeStabilityMetricsProvider::RegisterPrefs(registry); |
155 | 156 |
156 #if defined(OS_ANDROID) | 157 #if defined(OS_ANDROID) |
157 AndroidMetricsProvider::RegisterPrefs(registry); | 158 AndroidMetricsProvider::RegisterPrefs(registry); |
158 #endif // defined(OS_ANDROID) | 159 #endif // defined(OS_ANDROID) |
159 | 160 |
160 #if defined(ENABLE_PLUGINS) | 161 #if defined(ENABLE_PLUGINS) |
161 PluginMetricsProvider::RegisterPrefs(registry); | 162 PluginMetricsProvider::RegisterPrefs(registry); |
162 #endif // defined(ENABLE_PLUGINS) | 163 #endif // defined(ENABLE_PLUGINS) |
163 } | 164 } |
164 | 165 |
165 void ChromeMetricsServiceClient::SetClientID(const std::string& client_id) { | 166 void ChromeMetricsServiceClient::RegisterClientID( |
166 crash_keys::SetClientID(client_id); | 167 const std::string& client_id) { |
168 crash_keys::SetClientIDFromGUID(client_id); | |
169 | |
170 // Save a backup of the client id in Google Update settings. | |
171 GoogleUpdateSettings::SaveMetricsID(client_id); | |
167 } | 172 } |
168 | 173 |
169 bool ChromeMetricsServiceClient::IsOffTheRecordSessionActive() { | 174 bool ChromeMetricsServiceClient::IsOffTheRecordSessionActive() { |
170 return !chrome::IsOffTheRecordSessionActive(); | 175 return !chrome::IsOffTheRecordSessionActive(); |
171 } | 176 } |
172 | 177 |
173 std::string ChromeMetricsServiceClient::GetApplicationLocale() { | 178 std::string ChromeMetricsServiceClient::GetApplicationLocale() { |
174 return g_browser_process->GetApplicationLocale(); | 179 return g_browser_process->GetApplicationLocale(); |
175 } | 180 } |
176 | 181 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
528 // Capture the histogram samples. | 533 // Capture the histogram samples. |
529 if (dumps_with_crash != 0) | 534 if (dumps_with_crash != 0) |
530 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); | 535 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); |
531 if (dumps_with_no_crash != 0) | 536 if (dumps_with_no_crash != 0) |
532 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); | 537 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); |
533 int total_dumps = dumps_with_crash + dumps_with_no_crash; | 538 int total_dumps = dumps_with_crash + dumps_with_no_crash; |
534 if (total_dumps != 0) | 539 if (total_dumps != 0) |
535 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); | 540 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); |
536 } | 541 } |
537 #endif // defined(OS_WIN) | 542 #endif // defined(OS_WIN) |
OLD | NEW |