Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: components/metrics/metrics_log_base.h

Issue 301633006: Move ChromeOS hardware class init out of MetricsService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_METRICS_METRICS_LOG_BASE_H_ 8 #ifndef COMPONENTS_METRICS_METRICS_LOG_BASE_H_
9 #define COMPONENTS_METRICS_METRICS_LOG_BASE_H_ 9 #define COMPONENTS_METRICS_METRICS_LOG_BASE_H_
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 // Fills |encoded_log| with the serialized protobuf representation of the 69 // Fills |encoded_log| with the serialized protobuf representation of the
70 // record. Must only be called after CloseLog() has been called. 70 // record. Must only be called after CloseLog() has been called.
71 void GetEncodedLog(std::string* encoded_log); 71 void GetEncodedLog(std::string* encoded_log);
72 72
73 int num_events() const { 73 int num_events() const {
74 return uma_proto_.omnibox_event_size() + 74 return uma_proto_.omnibox_event_size() +
75 uma_proto_.user_action_event_size(); 75 uma_proto_.user_action_event_size();
76 } 76 }
77 77
78 void set_hardware_class(const std::string& hardware_class) {
79 uma_proto_.mutable_system_profile()->mutable_hardware()->set_hardware_class(
80 hardware_class);
81 }
82
83 LogType log_type() const { return log_type_; } 78 LogType log_type() const { return log_type_; }
84 79
85 protected: 80 protected:
86 bool locked() const { return locked_; } 81 bool locked() const { return locked_; }
87 82
88 metrics::ChromeUserMetricsExtension* uma_proto() { return &uma_proto_; } 83 metrics::ChromeUserMetricsExtension* uma_proto() { return &uma_proto_; }
89 const metrics::ChromeUserMetricsExtension* uma_proto() const { 84 const metrics::ChromeUserMetricsExtension* uma_proto() const {
90 return &uma_proto_; 85 return &uma_proto_;
91 } 86 }
92 87
93 private: 88 private:
94 // locked_ is true when record has been packed up for sending, and should 89 // locked_ is true when record has been packed up for sending, and should
95 // no longer be written to. It is only used for sanity checking and is 90 // no longer be written to. It is only used for sanity checking and is
96 // not a real lock. 91 // not a real lock.
97 bool locked_; 92 bool locked_;
98 93
99 // The type of the log, i.e. initial or ongoing. 94 // The type of the log, i.e. initial or ongoing.
100 const LogType log_type_; 95 const LogType log_type_;
101 96
102 // Stores the protocol buffer representation for this log. 97 // Stores the protocol buffer representation for this log.
103 metrics::ChromeUserMetricsExtension uma_proto_; 98 metrics::ChromeUserMetricsExtension uma_proto_;
104 99
105 DISALLOW_COPY_AND_ASSIGN(MetricsLogBase); 100 DISALLOW_COPY_AND_ASSIGN(MetricsLogBase);
106 }; 101 };
107 102
108 } // namespace metrics 103 } // namespace metrics
109 104
110 #endif // COMPONENTS_METRICS_METRICS_LOG_BASE_H_ 105 #endif // COMPONENTS_METRICS_METRICS_LOG_BASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_service.cc ('k') | components/metrics/metrics_log_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698