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