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 service that collects information about the user | 5 // This file defines a service that collects information about the user |
6 // experience in order to help improve future versions of the app. | 6 // experience in order to help improve future versions of the app. |
7 | 7 |
8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 struct WebPluginInfo; | 66 struct WebPluginInfo; |
67 } | 67 } |
68 | 68 |
69 namespace extensions { | 69 namespace extensions { |
70 class ExtensionDownloader; | 70 class ExtensionDownloader; |
71 class ManifestFetchData; | 71 class ManifestFetchData; |
72 class MetricsPrivateGetIsCrashReportingEnabledFunction; | 72 class MetricsPrivateGetIsCrashReportingEnabledFunction; |
73 } | 73 } |
74 | 74 |
75 namespace metrics { | 75 namespace metrics { |
| 76 class MetricsServiceClient; |
76 class MetricsStateManager; | 77 class MetricsStateManager; |
77 } | 78 } |
78 | 79 |
79 namespace net { | 80 namespace net { |
80 class URLFetcher; | 81 class URLFetcher; |
81 } | 82 } |
82 | 83 |
83 namespace prerender { | 84 namespace prerender { |
84 bool IsOmniboxEnabled(Profile* profile); | 85 bool IsOmniboxEnabled(Profile* profile); |
85 } | 86 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 UNINITIALIZED_PHASE = 0, | 125 UNINITIALIZED_PHASE = 0, |
125 START_METRICS_RECORDING = 100, | 126 START_METRICS_RECORDING = 100, |
126 CREATE_PROFILE = 200, | 127 CREATE_PROFILE = 200, |
127 STARTUP_TIMEBOMB_ARM = 300, | 128 STARTUP_TIMEBOMB_ARM = 300, |
128 THREAD_WATCHER_START = 400, | 129 THREAD_WATCHER_START = 400, |
129 MAIN_MESSAGE_LOOP_RUN = 500, | 130 MAIN_MESSAGE_LOOP_RUN = 500, |
130 SHUTDOWN_TIMEBOMB_ARM = 600, | 131 SHUTDOWN_TIMEBOMB_ARM = 600, |
131 SHUTDOWN_COMPLETE = 700, | 132 SHUTDOWN_COMPLETE = 700, |
132 }; | 133 }; |
133 | 134 |
134 // Creates the MetricsService with the given |state_manager|. Does not take | 135 // Creates the MetricsService with the given |state_manager| and |client|. |
135 // ownership of |state_manager|, instead stores a weak pointer to it. Caller | 136 // Does not take ownership of |state_manager| or |client|; instead stores a |
136 // should ensure that |state_manager| is valid for the lifetime of this class. | 137 // weak pointer to each. Caller should ensure that |state_manager| and |
137 explicit MetricsService(metrics::MetricsStateManager* state_manager); | 138 // |client| are valid for the lifetime of this class. |
| 139 MetricsService(metrics::MetricsStateManager* state_manager, |
| 140 metrics::MetricsServiceClient* client); |
138 virtual ~MetricsService(); | 141 virtual ~MetricsService(); |
139 | 142 |
140 // Initializes metrics recording state. Updates various bookkeeping values in | 143 // Initializes metrics recording state. Updates various bookkeeping values in |
141 // prefs and sets up the scheduler. This is a separate function rather than | 144 // prefs and sets up the scheduler. This is a separate function rather than |
142 // being done by the constructor so that field trials could be created before | 145 // being done by the constructor so that field trials could be created before |
143 // this is run. | 146 // this is run. |
144 void InitializeMetricsRecordingState(); | 147 void InitializeMetricsRecordingState(); |
145 | 148 |
146 // Starts the metrics system, turning on recording and uploading of metrics. | 149 // Starts the metrics system, turning on recording and uploading of metrics. |
147 // Should be called when starting up with metrics enabled, or when metrics | 150 // Should be called when starting up with metrics enabled, or when metrics |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 // process, and false otherwise. | 481 // process, and false otherwise. |
479 static bool IsPluginProcess(int process_type); | 482 static bool IsPluginProcess(int process_type); |
480 | 483 |
481 // Returns a list of synthetic field trials that were active for the entire | 484 // Returns a list of synthetic field trials that were active for the entire |
482 // duration of the current log. | 485 // duration of the current log. |
483 void GetCurrentSyntheticFieldTrials( | 486 void GetCurrentSyntheticFieldTrials( |
484 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials); | 487 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials); |
485 | 488 |
486 // Used to manage various metrics reporting state prefs, such as client id, | 489 // Used to manage various metrics reporting state prefs, such as client id, |
487 // low entropy source and whether metrics reporting is enabled. Weak pointer. | 490 // low entropy source and whether metrics reporting is enabled. Weak pointer. |
488 metrics::MetricsStateManager* state_manager_; | 491 metrics::MetricsStateManager* const state_manager_; |
| 492 |
| 493 // Used to interact with the embedder. Weak pointer; must outlive |this| |
| 494 // instance. |
| 495 metrics::MetricsServiceClient* const client_; |
489 | 496 |
490 base::ActionCallback action_callback_; | 497 base::ActionCallback action_callback_; |
491 | 498 |
492 content::NotificationRegistrar registrar_; | 499 content::NotificationRegistrar registrar_; |
493 | 500 |
494 // Set to true when |ResetMetricsIDsIfNecessary| is called for the first time. | 501 // Set to true when |ResetMetricsIDsIfNecessary| is called for the first time. |
495 // This prevents multiple resets within the same Chrome session. | 502 // This prevents multiple resets within the same Chrome session. |
496 bool metrics_ids_reset_check_performed_; | 503 bool metrics_ids_reset_check_performed_; |
497 | 504 |
498 // Indicate whether recording and reporting are currently happening. | 505 // Indicate whether recording and reporting are currently happening. |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 | 647 |
641 // Registers/unregisters |observer| to receive MetricsLog notifications | 648 // Registers/unregisters |observer| to receive MetricsLog notifications |
642 // from metrics service. | 649 // from metrics service. |
643 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); | 650 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); |
644 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); | 651 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); |
645 | 652 |
646 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 653 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
647 }; | 654 }; |
648 | 655 |
649 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 656 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |