| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/perftimer.h" | 14 #include "base/perftimer.h" |
| 15 #include "base/profiler/alternate_timer.h" | 15 #include "base/profiler/alternate_timer.h" |
| 16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
| 19 #include "base/third_party/nspr/prtime.h" | 19 #include "base/third_party/nspr/prtime.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #include "base/tracked_objects.h" | 21 #include "base/tracked_objects.h" |
| 22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 23 #include "chrome/browser/autocomplete/autocomplete_input.h" | 23 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 24 #include "chrome/browser/autocomplete/autocomplete_log.h" | 24 #include "chrome/browser/autocomplete/autocomplete_log.h" |
| 25 #include "chrome/browser/autocomplete/autocomplete_match.h" | 25 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 26 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 26 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 27 #include "chrome/browser/autocomplete/autocomplete_result.h" | 27 #include "chrome/browser/autocomplete/autocomplete_result.h" |
| 28 #include "chrome/browser/browser_process.h" | 28 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/browser/plugins/plugin_prefs.h" | 29 #include "chrome/browser/plugins/plugin_prefs.h" |
| 30 #include "chrome/browser/prefs/pref_registrar_simple.h" |
| 30 #include "chrome/browser/prefs/pref_service.h" | 31 #include "chrome/browser/prefs/pref_service.h" |
| 31 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
| 32 #include "chrome/common/chrome_version_info.h" | 33 #include "chrome/common/chrome_version_info.h" |
| 33 #include "chrome/common/logging_chrome.h" | 34 #include "chrome/common/logging_chrome.h" |
| 34 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | 35 #include "chrome/common/metrics/proto/omnibox_event.pb.h" |
| 35 #include "chrome/common/metrics/proto/profiler_event.pb.h" | 36 #include "chrome/common/metrics/proto/profiler_event.pb.h" |
| 36 #include "chrome/common/metrics/proto/system_profile.pb.h" | 37 #include "chrome/common/metrics/proto/system_profile.pb.h" |
| 37 #include "chrome/common/metrics/variations/variations_util.h" | 38 #include "chrome/common/metrics/variations/variations_util.h" |
| 38 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
| 39 #include "chrome/installer/util/google_update_settings.h" | 40 #include "chrome/installer/util/google_update_settings.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 272 |
| 272 static base::LazyInstance<std::string>::Leaky | 273 static base::LazyInstance<std::string>::Leaky |
| 273 g_version_extension = LAZY_INSTANCE_INITIALIZER; | 274 g_version_extension = LAZY_INSTANCE_INITIALIZER; |
| 274 | 275 |
| 275 MetricsLog::MetricsLog(const std::string& client_id, int session_id) | 276 MetricsLog::MetricsLog(const std::string& client_id, int session_id) |
| 276 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} | 277 : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} |
| 277 | 278 |
| 278 MetricsLog::~MetricsLog() {} | 279 MetricsLog::~MetricsLog() {} |
| 279 | 280 |
| 280 // static | 281 // static |
| 281 void MetricsLog::RegisterPrefs(PrefServiceSimple* local_state) { | 282 void MetricsLog::RegisterPrefs(PrefRegistrarSimple* local_state) { |
| 282 local_state->RegisterListPref(prefs::kStabilityPluginStats); | 283 local_state->RegisterListPref(prefs::kStabilityPluginStats); |
| 283 } | 284 } |
| 284 | 285 |
| 285 // static | 286 // static |
| 286 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { | 287 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { |
| 287 base::TimeTicks now = base::TimeTicks::Now(); | 288 base::TimeTicks now = base::TimeTicks::Now(); |
| 288 static base::TimeTicks last_updated_time(now); | 289 static base::TimeTicks last_updated_time(now); |
| 289 int64 incremental_time = (now - last_updated_time).InSeconds(); | 290 int64 incremental_time = (now - last_updated_time).InSeconds(); |
| 290 last_updated_time = now; | 291 last_updated_time = now; |
| 291 | 292 |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 ProductDataToProto(google_update_metrics.google_update_data, | 1030 ProductDataToProto(google_update_metrics.google_update_data, |
| 1030 google_update->mutable_google_update_status()); | 1031 google_update->mutable_google_update_status()); |
| 1031 } | 1032 } |
| 1032 | 1033 |
| 1033 if (!google_update_metrics.product_data.version.empty()) { | 1034 if (!google_update_metrics.product_data.version.empty()) { |
| 1034 ProductDataToProto(google_update_metrics.product_data, | 1035 ProductDataToProto(google_update_metrics.product_data, |
| 1035 google_update->mutable_client_status()); | 1036 google_update->mutable_client_status()); |
| 1036 } | 1037 } |
| 1037 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1038 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
| 1038 } | 1039 } |
| OLD | NEW |