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 // This file defines a set of user experience metrics data recorded by | 5 // This file defines a set of user experience metrics data recorded by |
6 // the MetricsService. This is the unit of data that is sent to the server. | 6 // the MetricsService. This is the unit of data that is sent to the server. |
7 | 7 |
8 #ifndef CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
9 #define CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "chrome/common/metrics_helpers.h" | 13 #include "chrome/common/metrics_helpers.h" |
14 #include "content/common/page_transition_types.h" | 14 #include "content/common/page_transition_types.h" |
15 | 15 |
16 struct AutocompleteLog; | 16 struct AutocompleteLog; |
17 class DictionaryValue; | |
18 class GURL; | 17 class GURL; |
19 class PrefService; | 18 class PrefService; |
20 | 19 |
| 20 namespace base { |
| 21 class DictionaryValue; |
| 22 } |
| 23 |
21 namespace webkit { | 24 namespace webkit { |
22 namespace npapi { | 25 namespace npapi { |
23 struct WebPluginInfo; | 26 struct WebPluginInfo; |
24 } | 27 } |
25 } | 28 } |
26 | 29 |
27 class MetricsLog : public MetricsLogBase { | 30 class MetricsLog : public MetricsLogBase { |
28 public: | 31 public: |
29 // Creates a new metrics log | 32 // Creates a new metrics log |
30 // client_id is the identifier for this profile on this installation | 33 // client_id is the identifier for this profile on this installation |
31 // session_id is an integer that's incremented on each application launch | 34 // session_id is an integer that's incremented on each application launch |
32 MetricsLog(const std::string& client_id, int session_id); | 35 MetricsLog(const std::string& client_id, int session_id); |
33 virtual ~MetricsLog(); | 36 virtual ~MetricsLog(); |
34 | 37 |
35 static void RegisterPrefs(PrefService* prefs); | 38 static void RegisterPrefs(PrefService* prefs); |
36 | 39 |
37 // Records the current operating environment. Takes the list of installed | 40 // Records the current operating environment. Takes the list of installed |
38 // plugins as a parameter because that can't be obtained synchronously | 41 // plugins as a parameter because that can't be obtained synchronously |
39 // from the UI thread. | 42 // from the UI thread. |
40 // profile_metrics, if non-null, gives a dictionary of all profile metrics | 43 // profile_metrics, if non-null, gives a dictionary of all profile metrics |
41 // that are to be recorded. Each value in profile_metrics should be a | 44 // that are to be recorded. Each value in profile_metrics should be a |
42 // dictionary giving the metrics for the profile. | 45 // dictionary giving the metrics for the profile. |
43 void RecordEnvironment( | 46 void RecordEnvironment( |
44 const std::vector<webkit::npapi::WebPluginInfo>& plugin_list, | 47 const std::vector<webkit::npapi::WebPluginInfo>& plugin_list, |
45 const DictionaryValue* profile_metrics); | 48 const base::DictionaryValue* profile_metrics); |
46 | 49 |
47 // Records the input text, available choices, and selected entry when the | 50 // Records the input text, available choices, and selected entry when the |
48 // user uses the Omnibox to open a URL. | 51 // user uses the Omnibox to open a URL. |
49 void RecordOmniboxOpenedURL(const AutocompleteLog& log); | 52 void RecordOmniboxOpenedURL(const AutocompleteLog& log); |
50 | 53 |
51 // Record recent delta for critical stability metrics. We can't wait for a | 54 // Record recent delta for critical stability metrics. We can't wait for a |
52 // restart to gather these, as that delay biases our observation away from | 55 // restart to gather these, as that delay biases our observation away from |
53 // users that run happily for a looooong time. We send increments with each | 56 // users that run happily for a looooong time. We send increments with each |
54 // uma log upload, just as we send histogram data. | 57 // uma log upload, just as we send histogram data. |
55 void RecordIncrementalStabilityElements(); | 58 void RecordIncrementalStabilityElements(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 92 |
90 // Writes the list of installed plugins. | 93 // Writes the list of installed plugins. |
91 void WritePluginList( | 94 void WritePluginList( |
92 const std::vector<webkit::npapi::WebPluginInfo>& plugin_list); | 95 const std::vector<webkit::npapi::WebPluginInfo>& plugin_list); |
93 | 96 |
94 // Within the profile group, write basic install info including appversion. | 97 // Within the profile group, write basic install info including appversion. |
95 void WriteInstallElement(); | 98 void WriteInstallElement(); |
96 | 99 |
97 // Writes all profile metrics. This invokes WriteProfileMetrics for each key | 100 // Writes all profile metrics. This invokes WriteProfileMetrics for each key |
98 // in all_profiles_metrics that starts with kProfilePrefix. | 101 // in all_profiles_metrics that starts with kProfilePrefix. |
99 void WriteAllProfilesMetrics(const DictionaryValue& all_profiles_metrics); | 102 void WriteAllProfilesMetrics( |
| 103 const base::DictionaryValue& all_profiles_metrics); |
100 | 104 |
101 // Writes metrics for the profile identified by key. This writes all | 105 // Writes metrics for the profile identified by key. This writes all |
102 // key/value pairs in profile_metrics. | 106 // key/value pairs in profile_metrics. |
103 void WriteProfileMetrics(const std::string& key, | 107 void WriteProfileMetrics(const std::string& key, |
104 const DictionaryValue& profile_metrics); | 108 const base::DictionaryValue& profile_metrics); |
105 | 109 |
106 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 110 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
107 }; | 111 }; |
108 | 112 |
109 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 113 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
OLD | NEW |