| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_METRICS_HELPERS_H_ | 8 #ifndef CHROME_COMMON_METRICS_HELPERS_H_ |
| 9 #define CHROME_COMMON_METRICS_HELPERS_H_ | 9 #define CHROME_COMMON_METRICS_HELPERS_H_ |
| 10 #pragma once | 10 #pragma once |
| 11 | 11 |
| 12 #include <map> | 12 #include <map> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/time.h" | 18 #include "base/time.h" |
| 19 #include "chrome/common/metrics_log_manager.h" | 19 #include "chrome/common/metrics_log_manager.h" |
| 20 #include "content/common/page_transition_types.h" | 20 #include "content/public/common/page_transition_types.h" |
| 21 | 21 |
| 22 class GURL; | 22 class GURL; |
| 23 class MetricsLog; | 23 class MetricsLog; |
| 24 | 24 |
| 25 // This class provides base functionality for logging metrics data. | 25 // This class provides base functionality for logging metrics data. |
| 26 class MetricsLogBase { | 26 class MetricsLogBase { |
| 27 public: | 27 public: |
| 28 // Creates a new metrics log | 28 // Creates a new metrics log |
| 29 // client_id is the identifier for this profile on this installation | 29 // client_id is the identifier for this profile on this installation |
| 30 // session_id is an integer that's incremented on each application launch | 30 // session_id is an integer that's incremented on each application launch |
| (...skipping 13 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 void RecordWindowEvent(WindowEventType type, int window_id, int parent_id); | 45 void RecordWindowEvent(WindowEventType type, int window_id, int parent_id); |
| 46 | 46 |
| 47 // Records a page load. | 47 // Records a page load. |
| 48 // window_id - the index of the tab in which the load took place | 48 // window_id - the index of the tab in which the load took place |
| 49 // url - which URL was loaded | 49 // url - which URL was loaded |
| 50 // origin - what kind of action initiated the load | 50 // origin - what kind of action initiated the load |
| 51 // load_time - how long it took to load the page | 51 // load_time - how long it took to load the page |
| 52 void RecordLoadEvent(int window_id, | 52 void RecordLoadEvent(int window_id, |
| 53 const GURL& url, | 53 const GURL& url, |
| 54 PageTransition::Type origin, | 54 content::PageTransition origin, |
| 55 int session_index, | 55 int session_index, |
| 56 base::TimeDelta load_time); | 56 base::TimeDelta load_time); |
| 57 | 57 |
| 58 // Record any changes in a given histogram for transmission. | 58 // Record any changes in a given histogram for transmission. |
| 59 void RecordHistogramDelta(const base::Histogram& histogram, | 59 void RecordHistogramDelta(const base::Histogram& histogram, |
| 60 const base::Histogram::SampleSet& snapshot); | 60 const base::Histogram::SampleSet& snapshot); |
| 61 | 61 |
| 62 // Stop writing to this record and generate the encoded representation. | 62 // Stop writing to this record and generate the encoded representation. |
| 63 // None of the Record* methods can be called after this is called. | 63 // None of the Record* methods can be called after this is called. |
| 64 void CloseLog(); | 64 void CloseLog(); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 const base::Histogram& histogram, | 246 const base::Histogram& histogram, |
| 247 const base::Histogram::SampleSet& snapshot); | 247 const base::Histogram::SampleSet& snapshot); |
| 248 virtual void InconsistencyDetected(int problem); | 248 virtual void InconsistencyDetected(int problem); |
| 249 virtual void UniqueInconsistencyDetected(int problem); | 249 virtual void UniqueInconsistencyDetected(int problem); |
| 250 virtual void SnapshotProblemResolved(int amount); | 250 virtual void SnapshotProblemResolved(int amount); |
| 251 | 251 |
| 252 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); | 252 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 #endif // CHROME_COMMON_METRICS_HELPERS_H_ | 255 #endif // CHROME_COMMON_METRICS_HELPERS_H_ |
| OLD | NEW |