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 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 #pragma once | 10 #pragma once |
11 | 11 |
12 #include <map> | 12 #include <map> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/process_util.h" | 19 #include "base/process_util.h" |
20 #include "chrome/browser/io_thread.h" | 20 #include "chrome/browser/io_thread.h" |
21 #include "chrome/common/metrics_helpers.h" | 21 #include "chrome/common/metrics_helpers.h" |
22 #include "content/common/net/url_fetcher.h" | 22 #include "content/public/common/url_fetcher_delegate.h" |
23 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
24 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
25 | 25 |
26 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
27 #include "chrome/browser/chromeos/external_metrics.h" | 27 #include "chrome/browser/chromeos/external_metrics.h" |
28 #endif | 28 #endif |
29 | 29 |
30 class BookmarkModel; | 30 class BookmarkModel; |
31 class BookmarkNode; | 31 class BookmarkNode; |
32 class HistogramSynchronizer; | 32 class HistogramSynchronizer; |
(...skipping 12 matching lines...) Expand all Loading... |
45 namespace prerender { | 45 namespace prerender { |
46 bool IsOmniboxEnabled(Profile* profile); | 46 bool IsOmniboxEnabled(Profile* profile); |
47 } | 47 } |
48 | 48 |
49 namespace webkit { | 49 namespace webkit { |
50 struct WebPluginInfo; | 50 struct WebPluginInfo; |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 class MetricsService : public content::NotificationObserver, | 54 class MetricsService : public content::NotificationObserver, |
55 public URLFetcher::Delegate, | 55 public content::URLFetcherDelegate, |
56 public MetricsServiceBase { | 56 public MetricsServiceBase { |
57 public: | 57 public: |
58 MetricsService(); | 58 MetricsService(); |
59 virtual ~MetricsService(); | 59 virtual ~MetricsService(); |
60 | 60 |
61 // Start/stop the metrics recording and uploading machine. These should be | 61 // Start/stop the metrics recording and uploading machine. These should be |
62 // used on startup and when the user clicks the checkbox in the prefs. | 62 // used on startup and when the user clicks the checkbox in the prefs. |
63 // StartRecordingOnly starts the metrics recording but not reporting, for use | 63 // StartRecordingOnly starts the metrics recording but not reporting, for use |
64 // in tests only. | 64 // in tests only. |
65 void Start(); | 65 void Start(); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void MakeStagedLog(); | 222 void MakeStagedLog(); |
223 | 223 |
224 // Record stats, client ID, Session ID, etc. in a special "first" log. | 224 // Record stats, client ID, Session ID, etc. in a special "first" log. |
225 void PrepareInitialLog(); | 225 void PrepareInitialLog(); |
226 | 226 |
227 // Prepared the staged log to be passed to the server. Upon return, | 227 // Prepared the staged log to be passed to the server. Upon return, |
228 // current_fetch_ should be reset with its upload data set to a compressed | 228 // current_fetch_ should be reset with its upload data set to a compressed |
229 // copy of the staged log. | 229 // copy of the staged log. |
230 void PrepareFetchWithStagedLog(); | 230 void PrepareFetchWithStagedLog(); |
231 | 231 |
232 // Implementation of URLFetcher::Delegate. Called after transmission | 232 // Implementation of content::URLFetcherDelegate. Called after transmission |
233 // completes (either successfully or with failure). | 233 // completes (either successfully or with failure). |
234 virtual void OnURLFetchComplete(const URLFetcher* source, | 234 virtual void OnURLFetchComplete(const URLFetcher* source); |
235 const GURL& url, | |
236 const net::URLRequestStatus& status, | |
237 int response_code, | |
238 const net::ResponseCookies& cookies, | |
239 const std::string& data); | |
240 | 235 |
241 // Logs debugging details, for the case where the server returns a response | 236 // Logs debugging details, for the case where the server returns a response |
242 // code other than 200. | 237 // code other than 200. |
243 void LogBadResponseCode(); | 238 void LogBadResponseCode(); |
244 | 239 |
245 // Records a window-related notification. | 240 // Records a window-related notification. |
246 void LogWindowChange(int type, | 241 void LogWindowChange(int type, |
247 const content::NotificationSource& source, | 242 const content::NotificationSource& source, |
248 const content::NotificationDetails& details); | 243 const content::NotificationDetails& details); |
249 | 244 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 friend class InstantFieldTrial; | 400 friend class InstantFieldTrial; |
406 friend bool prerender::IsOmniboxEnabled(Profile* profile); | 401 friend bool prerender::IsOmniboxEnabled(Profile* profile); |
407 | 402 |
408 // Returns true if prefs::kMetricsReportingEnabled is set. | 403 // Returns true if prefs::kMetricsReportingEnabled is set. |
409 static bool IsMetricsReportingEnabled(); | 404 static bool IsMetricsReportingEnabled(); |
410 | 405 |
411 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 406 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
412 }; | 407 }; |
413 | 408 |
414 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 409 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |