OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 #include "base/time.h" | 21 #include "base/time.h" |
22 #include "base/tracked_objects.h" | 22 #include "base/tracked_objects.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "chrome/browser/autocomplete/autocomplete_input.h" | 24 #include "chrome/browser/autocomplete/autocomplete_input.h" |
25 #include "chrome/browser/autocomplete/autocomplete_log.h" | 25 #include "chrome/browser/autocomplete/autocomplete_log.h" |
26 #include "chrome/browser/autocomplete/autocomplete_match.h" | 26 #include "chrome/browser/autocomplete/autocomplete_match.h" |
27 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 27 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
28 #include "chrome/browser/autocomplete/autocomplete_result.h" | 28 #include "chrome/browser/autocomplete/autocomplete_result.h" |
29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
30 #include "chrome/browser/plugins/plugin_prefs.h" | 30 #include "chrome/browser/plugins/plugin_prefs.h" |
| 31 #include "chrome/browser/prefs/pref_registry_simple.h" |
31 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
32 #include "chrome/browser/profiles/profile_manager.h" | 33 #include "chrome/browser/profiles/profile_manager.h" |
33 #include "chrome/common/chrome_version_info.h" | 34 #include "chrome/common/chrome_version_info.h" |
34 #include "chrome/common/logging_chrome.h" | 35 #include "chrome/common/logging_chrome.h" |
35 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | 36 #include "chrome/common/metrics/proto/omnibox_event.pb.h" |
36 #include "chrome/common/metrics/proto/profiler_event.pb.h" | 37 #include "chrome/common/metrics/proto/profiler_event.pb.h" |
37 #include "chrome/common/metrics/proto/system_profile.pb.h" | 38 #include "chrome/common/metrics/proto/system_profile.pb.h" |
38 #include "chrome/common/metrics/variations/variations_util.h" | 39 #include "chrome/common/metrics/variations/variations_util.h" |
39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
40 #include "chrome/installer/util/google_update_settings.h" | 41 #include "chrome/installer/util/google_update_settings.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 311 |
311 static base::LazyInstance<std::string>::Leaky | 312 static base::LazyInstance<std::string>::Leaky |
312 g_version_extension = LAZY_INSTANCE_INITIALIZER; | 313 g_version_extension = LAZY_INSTANCE_INITIALIZER; |
313 | 314 |
314 MetricsLog::MetricsLog(const std::string& client_id, int session_id) | 315 MetricsLog::MetricsLog(const std::string& client_id, int session_id) |
315 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} | 316 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} |
316 | 317 |
317 MetricsLog::~MetricsLog() {} | 318 MetricsLog::~MetricsLog() {} |
318 | 319 |
319 // static | 320 // static |
320 void MetricsLog::RegisterPrefs(PrefServiceSimple* local_state) { | 321 void MetricsLog::RegisterPrefs(PrefRegistrySimple* local_state) { |
321 local_state->RegisterListPref(prefs::kStabilityPluginStats); | 322 local_state->RegisterListPref(prefs::kStabilityPluginStats); |
322 } | 323 } |
323 | 324 |
324 // static | 325 // static |
325 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { | 326 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { |
326 base::TimeTicks now = base::TimeTicks::Now(); | 327 base::TimeTicks now = base::TimeTicks::Now(); |
327 static base::TimeTicks last_updated_time(now); | 328 static base::TimeTicks last_updated_time(now); |
328 int64 incremental_time = (now - last_updated_time).InSeconds(); | 329 int64 incremental_time = (now - last_updated_time).InSeconds(); |
329 last_updated_time = now; | 330 last_updated_time = now; |
330 | 331 |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 ProductDataToProto(google_update_metrics.google_update_data, | 1075 ProductDataToProto(google_update_metrics.google_update_data, |
1075 google_update->mutable_google_update_status()); | 1076 google_update->mutable_google_update_status()); |
1076 } | 1077 } |
1077 | 1078 |
1078 if (!google_update_metrics.product_data.version.empty()) { | 1079 if (!google_update_metrics.product_data.version.empty()) { |
1079 ProductDataToProto(google_update_metrics.product_data, | 1080 ProductDataToProto(google_update_metrics.product_data, |
1080 google_update->mutable_client_status()); | 1081 google_update->mutable_client_status()); |
1081 } | 1082 } |
1082 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1083 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
1083 } | 1084 } |
OLD | NEW |