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

Side by Side Diff: chrome/browser/metrics/metrics_service.h

Issue 12039079: content: convert user action notification to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
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
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/metrics/field_trial.h" 19 #include "base/metrics/field_trial.h"
20 #include "base/process_util.h" 20 #include "base/process_util.h"
21 #include "chrome/browser/metrics/metrics_log.h" 21 #include "chrome/browser/metrics/metrics_log.h"
22 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" 22 #include "chrome/browser/metrics/tracking_synchronizer_observer.h"
23 #include "chrome/common/metrics/metrics_service_base.h" 23 #include "chrome/common/metrics/metrics_service_base.h"
24 #include "chrome/installer/util/google_update_settings.h" 24 #include "chrome/installer/util/google_update_settings.h"
25 #include "content/public/browser/notification_observer.h" 25 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h" 26 #include "content/public/browser/notification_registrar.h"
27 #include "content/public/browser/user_metrics.h"
27 #include "net/url_request/url_fetcher_delegate.h" 28 #include "net/url_request/url_fetcher_delegate.h"
28 29
29 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
30 #include "chrome/browser/chromeos/external_metrics.h" 31 #include "chrome/browser/chromeos/external_metrics.h"
31 #endif 32 #endif
32 33
33 class BookmarkModel; 34 class BookmarkModel;
34 class BookmarkNode; 35 class BookmarkNode;
35 class MetricsReportingScheduler; 36 class MetricsReportingScheduler;
36 class PrefService; 37 class PrefService;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // Task launched by OnInitTaskGotPluginInfo() that continues the init task by 230 // Task launched by OnInitTaskGotPluginInfo() that continues the init task by
230 // loading Google Update statistics. Called on a blocking pool thread. 231 // loading Google Update statistics. Called on a blocking pool thread.
231 static void InitTaskGetGoogleUpdateData(base::WeakPtr<MetricsService> self, 232 static void InitTaskGetGoogleUpdateData(base::WeakPtr<MetricsService> self,
232 base::MessageLoopProxy* target_loop); 233 base::MessageLoopProxy* target_loop);
233 234
234 // Callback from InitTaskGetGoogleUpdateData() that continues the init task by 235 // Callback from InitTaskGetGoogleUpdateData() that continues the init task by
235 // loading profiler data. 236 // loading profiler data.
236 void OnInitTaskGotGoogleUpdateData( 237 void OnInitTaskGotGoogleUpdateData(
237 const GoogleUpdateMetrics& google_update_metrics); 238 const GoogleUpdateMetrics& google_update_metrics);
238 239
240 void OnUserAction(const std::string& action);
241
239 // TrackingSynchronizerObserver: 242 // TrackingSynchronizerObserver:
240 virtual void ReceivedProfilerData( 243 virtual void ReceivedProfilerData(
241 const tracked_objects::ProcessDataSnapshot& process_data, 244 const tracked_objects::ProcessDataSnapshot& process_data,
242 content::ProcessType process_type) OVERRIDE; 245 content::ProcessType process_type) OVERRIDE;
243 // Callback that moves the state to INIT_TASK_DONE. 246 // Callback that moves the state to INIT_TASK_DONE.
244 virtual void FinishedReceivingProfilerData() OVERRIDE; 247 virtual void FinishedReceivingProfilerData() OVERRIDE;
245 248
246 // Returns the low entropy source for this client. This is a random value 249 // Returns the low entropy source for this client. This is a random value
247 // that is non-identifying amongst browser clients. This method will 250 // that is non-identifying amongst browser clients. This method will
248 // generate the entropy source value if it has not been called before. 251 // generate the entropy source value if it has not been called before.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 394
392 // Logs the initiation of a page load 395 // Logs the initiation of a page load
393 void LogLoadStarted(); 396 void LogLoadStarted();
394 397
395 // Records a page load notification. 398 // Records a page load notification.
396 void LogLoadComplete(int type, 399 void LogLoadComplete(int type,
397 const content::NotificationSource& source, 400 const content::NotificationSource& source,
398 const content::NotificationDetails& details); 401 const content::NotificationDetails& details);
399 402
400 // Checks whether a notification can be logged. 403 // Checks whether a notification can be logged.
401 bool CanLogNotification(int type, 404 bool CanLogNotification();
402 const content::NotificationSource& source,
403 const content::NotificationDetails& details);
404 405
405 // Sets the value of the specified path in prefs and schedules a save. 406 // Sets the value of the specified path in prefs and schedules a save.
406 void RecordBooleanPrefValue(const char* path, bool value); 407 void RecordBooleanPrefValue(const char* path, bool value);
407 408
408 // Returns true if process of type |type| should be counted as a plugin 409 // Returns true if process of type |type| should be counted as a plugin
409 // process, and false otherwise. 410 // process, and false otherwise.
410 static bool IsPluginProcess(content::ProcessType type); 411 static bool IsPluginProcess(content::ProcessType type);
411 412
413 content::ActionCallback action_callback_;
414
412 content::NotificationRegistrar registrar_; 415 content::NotificationRegistrar registrar_;
413 416
414 // Indicate whether recording and reporting are currently happening. 417 // Indicate whether recording and reporting are currently happening.
415 // These should not be set directly, but by calling SetRecording and 418 // These should not be set directly, but by calling SetRecording and
416 // SetReporting. 419 // SetReporting.
417 bool recording_active_; 420 bool recording_active_;
418 bool reporting_active_; 421 bool reporting_active_;
419 422
420 // Indicate whether test mode is enabled, where the initial log should never 423 // Indicate whether test mode is enabled, where the initial log should never
421 // be cut, and logs are neither persisted nor uploaded. 424 // be cut, and logs are neither persisted nor uploaded.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 friend class extensions::ExtensionDownloader; 531 friend class extensions::ExtensionDownloader;
529 friend class extensions::ManifestFetchData; 532 friend class extensions::ManifestFetchData;
530 533
531 // Returns true if prefs::kMetricsReportingEnabled is set. 534 // Returns true if prefs::kMetricsReportingEnabled is set.
532 static bool IsMetricsReportingEnabled(); 535 static bool IsMetricsReportingEnabled();
533 536
534 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); 537 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper);
535 }; 538 };
536 539
537 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 540 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698