OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 6 |
7 //------------------------------------------------------------------------------ | 7 //------------------------------------------------------------------------------ |
8 // Description of the life cycle of a instance of MetricsService. | 8 // Description of the life cycle of a instance of MetricsService. |
9 // | 9 // |
10 // OVERVIEW | 10 // OVERVIEW |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
162 #include <windows.h> | 162 #include <windows.h> |
163 #include <objbase.h> | 163 #include <objbase.h> |
164 #endif | 164 #endif |
165 | 165 |
166 #include "base/base64.h" | 166 #include "base/base64.h" |
167 #include "base/command_line.h" | 167 #include "base/command_line.h" |
168 #include "base/histogram.h" | 168 #include "base/histogram.h" |
169 #include "base/md5.h" | 169 #include "base/md5.h" |
| 170 #include "base/string_number_conversions.h" |
170 #include "base/thread.h" | 171 #include "base/thread.h" |
171 #include "base/values.h" | 172 #include "base/values.h" |
172 #include "chrome/browser/bookmarks/bookmark_model.h" | 173 #include "chrome/browser/bookmarks/bookmark_model.h" |
173 #include "chrome/browser/browser_list.h" | 174 #include "chrome/browser/browser_list.h" |
174 #include "chrome/browser/browser_process.h" | 175 #include "chrome/browser/browser_process.h" |
175 #include "chrome/browser/load_notification_details.h" | 176 #include "chrome/browser/load_notification_details.h" |
176 #include "chrome/browser/memory_details.h" | 177 #include "chrome/browser/memory_details.h" |
177 #include "chrome/browser/metrics/histogram_synchronizer.h" | 178 #include "chrome/browser/metrics/histogram_synchronizer.h" |
178 #include "chrome/browser/metrics/metrics_log.h" | 179 #include "chrome/browser/metrics/metrics_log.h" |
179 #include "chrome/browser/pref_service.h" | 180 #include "chrome/browser/pref_service.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 if (client_id_.empty()) { | 509 if (client_id_.empty()) { |
509 PrefService* pref = g_browser_process->local_state(); | 510 PrefService* pref = g_browser_process->local_state(); |
510 DCHECK(pref); | 511 DCHECK(pref); |
511 client_id_ = pref->GetString(prefs::kMetricsClientID); | 512 client_id_ = pref->GetString(prefs::kMetricsClientID); |
512 if (client_id_.empty()) { | 513 if (client_id_.empty()) { |
513 client_id_ = GenerateClientID(); | 514 client_id_ = GenerateClientID(); |
514 pref->SetString(prefs::kMetricsClientID, client_id_); | 515 pref->SetString(prefs::kMetricsClientID, client_id_); |
515 | 516 |
516 // Might as well make a note of how long this ID has existed | 517 // Might as well make a note of how long this ID has existed |
517 pref->SetString(prefs::kMetricsClientIDTimestamp, | 518 pref->SetString(prefs::kMetricsClientIDTimestamp, |
518 Int64ToString(Time::Now().ToTimeT())); | 519 base::Int64ToString(Time::Now().ToTimeT())); |
519 } | 520 } |
520 } | 521 } |
521 child_process_logging::SetClientId(client_id_); | 522 child_process_logging::SetClientId(client_id_); |
522 StartRecording(); | 523 StartRecording(); |
523 | 524 |
524 registrar_.Add(this, NotificationType::BROWSER_OPENED, | 525 registrar_.Add(this, NotificationType::BROWSER_OPENED, |
525 NotificationService::AllSources()); | 526 NotificationService::AllSources()); |
526 registrar_.Add(this, NotificationType::BROWSER_CLOSED, | 527 registrar_.Add(this, NotificationType::BROWSER_CLOSED, |
527 NotificationService::AllSources()); | 528 NotificationService::AllSources()); |
528 registrar_.Add(this, NotificationType::USER_ACTION, | 529 registrar_.Add(this, NotificationType::USER_ACTION, |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 hardware_class = kUnknownHardwareClass; | 1952 hardware_class = kUnknownHardwareClass; |
1952 } | 1953 } |
1953 return hardware_class; | 1954 return hardware_class; |
1954 } | 1955 } |
1955 | 1956 |
1956 void MetricsService::StartExternalMetrics() { | 1957 void MetricsService::StartExternalMetrics() { |
1957 external_metrics_ = new chromeos::ExternalMetrics; | 1958 external_metrics_ = new chromeos::ExternalMetrics; |
1958 external_metrics_->Start(); | 1959 external_metrics_->Start(); |
1959 } | 1960 } |
1960 #endif | 1961 #endif |
OLD | NEW |