| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/metrics/field_trial.h" |
| 16 #include "chrome/common/metrics/metrics_log_base.h" | 17 #include "chrome/common/metrics/metrics_log_base.h" |
| 18 #include "ui/gfx/size.h" |
| 17 | 19 |
| 18 struct AutocompleteLog; | 20 struct AutocompleteLog; |
| 19 class PrefService; | 21 class PrefService; |
| 20 | 22 |
| 21 namespace base { | 23 namespace base { |
| 22 class DictionaryValue; | 24 class DictionaryValue; |
| 23 } | 25 } |
| 24 | 26 |
| 25 namespace webkit { | 27 namespace webkit { |
| 26 struct WebPluginInfo; | 28 struct WebPluginInfo; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 66 |
| 65 // Record recent delta for critical stability metrics. We can't wait for a | 67 // Record recent delta for critical stability metrics. We can't wait for a |
| 66 // restart to gather these, as that delay biases our observation away from | 68 // restart to gather these, as that delay biases our observation away from |
| 67 // users that run happily for a looooong time. We send increments with each | 69 // users that run happily for a looooong time. We send increments with each |
| 68 // uma log upload, just as we send histogram data. Takes the list of | 70 // uma log upload, just as we send histogram data. Takes the list of |
| 69 // installed plugins as a parameter because that can't be obtained | 71 // installed plugins as a parameter because that can't be obtained |
| 70 // synchronously from the UI thread. | 72 // synchronously from the UI thread. |
| 71 void RecordIncrementalStabilityElements( | 73 void RecordIncrementalStabilityElements( |
| 72 const std::vector<webkit::WebPluginInfo>& plugin_list); | 74 const std::vector<webkit::WebPluginInfo>& plugin_list); |
| 73 | 75 |
| 76 protected: |
| 77 // Exposed for the sake of mocking in test code. |
| 78 |
| 79 // Returns the PrefService from which to log metrics data. |
| 80 virtual PrefService* GetPrefService(); |
| 81 |
| 82 // Returns the screen size for the primary monitor. |
| 83 virtual gfx::Size GetScreenSize() const; |
| 84 |
| 85 // Returns the number of monitors the user is using. |
| 86 virtual int GetScreenCount() const; |
| 87 |
| 88 // Fills |field_trial_ids| with the list of initialized field trials name and |
| 89 // group ids. |
| 90 virtual void GetFieldTrialIds( |
| 91 std::vector<base::FieldTrial::NameGroupId>* field_trial_ids) const; |
| 92 |
| 74 private: | 93 private: |
| 75 FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData); | 94 FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData); |
| 76 | 95 |
| 77 // Writes application stability metrics (as part of the profile log). | 96 // Writes application stability metrics (as part of the profile log). |
| 78 // NOTE: Has the side-effect of clearing those counts. | 97 // NOTE: Has the side-effect of clearing those counts. |
| 79 void WriteStabilityElement( | 98 void WriteStabilityElement( |
| 80 const std::vector<webkit::WebPluginInfo>& plugin_list, | 99 const std::vector<webkit::WebPluginInfo>& plugin_list, |
| 81 PrefService* pref); | 100 PrefService* pref); |
| 82 | 101 |
| 83 // Within stability group, write plugin crash stats. | 102 // Within stability group, write plugin crash stats. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 108 | 127 |
| 109 // Writes metrics for the profile identified by key. This writes all | 128 // Writes metrics for the profile identified by key. This writes all |
| 110 // key/value pairs in profile_metrics. | 129 // key/value pairs in profile_metrics. |
| 111 void WriteProfileMetrics(const std::string& key, | 130 void WriteProfileMetrics(const std::string& key, |
| 112 const base::DictionaryValue& profile_metrics); | 131 const base::DictionaryValue& profile_metrics); |
| 113 | 132 |
| 114 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 133 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
| 115 }; | 134 }; |
| 116 | 135 |
| 117 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 136 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
| OLD | NEW |