Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_METRICS_EXPORT_USERACTION_SAMPLE_H_ | |
| 6 #define COMPONENTS_METRICS_EXPORT_USERACTION_SAMPLE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/base_export.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "components/metrics/export/metric_sample.h" | |
| 14 | |
| 15 namespace metrics { | |
| 16 | |
| 17 // Represent a logged action. | |
| 18 // This class is meant to be used to serialize and deserialize samples to | |
| 19 // send them from ChromeOS to Chrome. | |
| 20 class BASE_EXPORT UserActionSample : public MetricSample { | |
| 21 public: | |
| 22 explicit UserActionSample(const std::string& action); | |
| 23 virtual ~UserActionSample(); | |
| 24 | |
| 25 // Return a serialized version of the sample on the format: | |
| 26 // useraction\0|name_|\0 | |
| 27 virtual std::string ToString() const OVERRIDE; | |
| 28 | |
| 29 // Deserialize a sample passed as a string. | |
| 30 // Returns a UserActionSample if the deserialization is successful and NULL | |
| 31 // otherwise. | |
| 32 static scoped_ptr<UserActionSample> ReadUserAction( | |
| 33 const std::string& useraction); | |
|
Alexei Svitkine (slow)
2014/05/01 15:57:09
Nit: user_action or just action. Make consistent w
| |
| 34 | |
| 35 private: | |
| 36 DISALLOW_COPY_AND_ASSIGN(UserActionSample); | |
| 37 }; | |
| 38 | |
| 39 } // namespace metrics | |
| 40 | |
| 41 #endif // COMPONENTS_METRICS_EXPORT_USERACTION_SAMPLE_H_ | |
| OLD | NEW |