| 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 GURL; | 17 class GURL; |
| 18 class PrefService; | 18 class PrefService; |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class DictionaryValue; | 21 class DictionaryValue; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace webkit { | 24 namespace webkit { |
| 25 namespace npapi { | |
| 26 struct WebPluginInfo; | 25 struct WebPluginInfo; |
| 27 } | 26 } |
| 28 } | |
| 29 | 27 |
| 30 class MetricsLog : public MetricsLogBase { | 28 class MetricsLog : public MetricsLogBase { |
| 31 public: | 29 public: |
| 32 // Creates a new metrics log | 30 // Creates a new metrics log |
| 33 // client_id is the identifier for this profile on this installation | 31 // client_id is the identifier for this profile on this installation |
| 34 // session_id is an integer that's incremented on each application launch | 32 // session_id is an integer that's incremented on each application launch |
| 35 MetricsLog(const std::string& client_id, int session_id); | 33 MetricsLog(const std::string& client_id, int session_id); |
| 36 virtual ~MetricsLog(); | 34 virtual ~MetricsLog(); |
| 37 | 35 |
| 38 static void RegisterPrefs(PrefService* prefs); | 36 static void RegisterPrefs(PrefService* prefs); |
| 39 | 37 |
| 40 // Records the current operating environment. Takes the list of installed | 38 // Records the current operating environment. Takes the list of installed |
| 41 // plugins as a parameter because that can't be obtained synchronously | 39 // plugins as a parameter because that can't be obtained synchronously |
| 42 // from the UI thread. | 40 // from the UI thread. |
| 43 // profile_metrics, if non-null, gives a dictionary of all profile metrics | 41 // profile_metrics, if non-null, gives a dictionary of all profile metrics |
| 44 // that are to be recorded. Each value in profile_metrics should be a | 42 // that are to be recorded. Each value in profile_metrics should be a |
| 45 // dictionary giving the metrics for the profile. | 43 // dictionary giving the metrics for the profile. |
| 46 void RecordEnvironment( | 44 void RecordEnvironment( |
| 47 const std::vector<webkit::npapi::WebPluginInfo>& plugin_list, | 45 const std::vector<webkit::WebPluginInfo>& plugin_list, |
| 48 const base::DictionaryValue* profile_metrics); | 46 const base::DictionaryValue* profile_metrics); |
| 49 | 47 |
| 50 // Records the input text, available choices, and selected entry when the | 48 // Records the input text, available choices, and selected entry when the |
| 51 // user uses the Omnibox to open a URL. | 49 // user uses the Omnibox to open a URL. |
| 52 void RecordOmniboxOpenedURL(const AutocompleteLog& log); | 50 void RecordOmniboxOpenedURL(const AutocompleteLog& log); |
| 53 | 51 |
| 54 // Record recent delta for critical stability metrics. We can't wait for a | 52 // Record recent delta for critical stability metrics. We can't wait for a |
| 55 // restart to gather these, as that delay biases our observation away from | 53 // restart to gather these, as that delay biases our observation away from |
| 56 // users that run happily for a looooong time. We send increments with each | 54 // users that run happily for a looooong time. We send increments with each |
| 57 // uma log upload, just as we send histogram data. | 55 // uma log upload, just as we send histogram data. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 85 void WriteRequiredStabilityAttributes(PrefService* pref); | 83 void WriteRequiredStabilityAttributes(PrefService* pref); |
| 86 | 84 |
| 87 // Within the stability group, write attributes that need to be updated asap | 85 // Within the stability group, write attributes that need to be updated asap |
| 88 // and can't be delayed until the user decides to restart chromium. | 86 // and can't be delayed until the user decides to restart chromium. |
| 89 // Delaying these stats would bias metrics away from happy long lived | 87 // Delaying these stats would bias metrics away from happy long lived |
| 90 // chromium processes (ones that don't crash, and keep on running). | 88 // chromium processes (ones that don't crash, and keep on running). |
| 91 void WriteRealtimeStabilityAttributes(PrefService* pref); | 89 void WriteRealtimeStabilityAttributes(PrefService* pref); |
| 92 | 90 |
| 93 // Writes the list of installed plugins. | 91 // Writes the list of installed plugins. |
| 94 void WritePluginList( | 92 void WritePluginList( |
| 95 const std::vector<webkit::npapi::WebPluginInfo>& plugin_list); | 93 const std::vector<webkit::WebPluginInfo>& plugin_list); |
| 96 | 94 |
| 97 // Within the profile group, write basic install info including appversion. | 95 // Within the profile group, write basic install info including appversion. |
| 98 void WriteInstallElement(); | 96 void WriteInstallElement(); |
| 99 | 97 |
| 100 // Writes all profile metrics. This invokes WriteProfileMetrics for each key | 98 // Writes all profile metrics. This invokes WriteProfileMetrics for each key |
| 101 // in all_profiles_metrics that starts with kProfilePrefix. | 99 // in all_profiles_metrics that starts with kProfilePrefix. |
| 102 void WriteAllProfilesMetrics( | 100 void WriteAllProfilesMetrics( |
| 103 const base::DictionaryValue& all_profiles_metrics); | 101 const base::DictionaryValue& all_profiles_metrics); |
| 104 | 102 |
| 105 // Writes metrics for the profile identified by key. This writes all | 103 // Writes metrics for the profile identified by key. This writes all |
| 106 // key/value pairs in profile_metrics. | 104 // key/value pairs in profile_metrics. |
| 107 void WriteProfileMetrics(const std::string& key, | 105 void WriteProfileMetrics(const std::string& key, |
| 108 const base::DictionaryValue& profile_metrics); | 106 const base::DictionaryValue& profile_metrics); |
| 109 | 107 |
| 110 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 108 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
| 111 }; | 109 }; |
| 112 | 110 |
| 113 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 111 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
| OLD | NEW |