| OLD | NEW | 
|    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2011 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" | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
|   34 extern "C" IMAGE_DOS_HEADER __ImageBase; |   34 extern "C" IMAGE_DOS_HEADER __ImageBase; | 
|   35 #endif |   35 #endif | 
|   36  |   36  | 
|   37 MetricsLog::MetricsLog(const std::string& client_id, int session_id) |   37 MetricsLog::MetricsLog(const std::string& client_id, int session_id) | 
|   38     : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} |   38     : MetricsLogBase(client_id, session_id, MetricsLog::GetVersionString()) {} | 
|   39  |   39  | 
|   40 MetricsLog::~MetricsLog() {} |   40 MetricsLog::~MetricsLog() {} | 
|   41  |   41  | 
|   42 // static |   42 // static | 
|   43 void MetricsLog::RegisterPrefs(PrefService* local_state) { |   43 void MetricsLog::RegisterPrefs(PrefService* local_state) { | 
|   44   local_state->RegisterListPref(prefs::kStabilityPluginStats); |   44   local_state->RegisterListPref(prefs::kStabilityPluginStats, | 
 |   45                                 false /* don't sync pref */); | 
|   45 } |   46 } | 
|   46  |   47  | 
|   47 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { |   48 int64 MetricsLog::GetIncrementalUptime(PrefService* pref) { | 
|   48   base::TimeTicks now = base::TimeTicks::Now(); |   49   base::TimeTicks now = base::TimeTicks::Now(); | 
|   49   static base::TimeTicks last_updated_time(now); |   50   static base::TimeTicks last_updated_time(now); | 
|   50   int64 incremental_time = (now - last_updated_time).InSeconds(); |   51   int64 incremental_time = (now - last_updated_time).InSeconds(); | 
|   51   last_updated_time = now; |   52   last_updated_time = now; | 
|   52  |   53  | 
|   53   if (incremental_time > 0) { |   54   if (incremental_time > 0) { | 
|   54     int64 metrics_uptime = pref->GetInt64(prefs::kUninstallMetricsUptimeSec); |   55     int64 metrics_uptime = pref->GetInt64(prefs::kUninstallMetricsUptimeSec); | 
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  484       const std::string result_type(AutocompleteMatch::TypeToString(i->type)); |  485       const std::string result_type(AutocompleteMatch::TypeToString(i->type)); | 
|  485       if (!result_type.empty()) |  486       if (!result_type.empty()) | 
|  486         WriteAttribute("resulttype", result_type); |  487         WriteAttribute("resulttype", result_type); | 
|  487       WriteIntAttribute("relevance", i->relevance); |  488       WriteIntAttribute("relevance", i->relevance); | 
|  488       WriteIntAttribute("isstarred", i->starred ? 1 : 0); |  489       WriteIntAttribute("isstarred", i->starred ? 1 : 0); | 
|  489     } |  490     } | 
|  490   } |  491   } | 
|  491  |  492  | 
|  492   ++num_events_; |  493   ++num_events_; | 
|  493 } |  494 } | 
| OLD | NEW |