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

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

Issue 289373007: Rename MetricsServiceHelper to ChromeMetricsServiceAccessor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again. Created 6 years, 7 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
(...skipping 20 matching lines...) Expand all
31 #include "content/public/browser/browser_child_process_observer.h" 31 #include "content/public/browser/browser_child_process_observer.h"
32 #include "content/public/browser/notification_observer.h" 32 #include "content/public/browser/notification_observer.h"
33 #include "content/public/browser/notification_registrar.h" 33 #include "content/public/browser/notification_registrar.h"
34 #include "content/public/browser/user_metrics.h" 34 #include "content/public/browser/user_metrics.h"
35 #include "net/url_request/url_fetcher_delegate.h" 35 #include "net/url_request/url_fetcher_delegate.h"
36 36
37 #if defined(OS_ANDROID) 37 #if defined(OS_ANDROID)
38 #include "chrome/browser/android/activity_type_ids.h" 38 #include "chrome/browser/android/activity_type_ids.h"
39 #endif 39 #endif
40 40
41 class ChromeBrowserMetricsServiceObserver;
42 class MetricsReportingScheduler; 41 class MetricsReportingScheduler;
43 class PrefService; 42 class PrefService;
44 class PrefRegistrySimple; 43 class PrefRegistrySimple;
45 class Profile;
46 class TemplateURLService;
47
48 namespace {
49 class CrashesDOMHandler;
50 class FlashDOMHandler;
51 }
52 44
53 namespace base { 45 namespace base {
54 class DictionaryValue; 46 class DictionaryValue;
55 class MessageLoopProxy; 47 class MessageLoopProxy;
56 } 48 }
57 49
58 namespace variations { 50 namespace variations {
59 struct ActiveGroupId; 51 struct ActiveGroupId;
60 } 52 }
61 53
62 namespace content { 54 namespace content {
63 class RenderProcessHost; 55 class RenderProcessHost;
64 class WebContents; 56 class WebContents;
65 struct WebPluginInfo; 57 struct WebPluginInfo;
66 } 58 }
67 59
68 namespace extensions {
69 class ExtensionDownloader;
70 class ManifestFetchData;
71 class MetricsPrivateGetIsCrashReportingEnabledFunction;
72 }
73
74 namespace metrics { 60 namespace metrics {
75 class MetricsStateManager; 61 class MetricsStateManager;
76 } 62 }
77 63
78 namespace net { 64 namespace net {
79 class URLFetcher; 65 class URLFetcher;
80 } 66 }
81 67
82 namespace prerender {
83 bool IsOmniboxEnabled(Profile* profile);
84 }
85
86 namespace system_logs {
87 class ChromeInternalLogSource;
88 }
89
90 namespace tracked_objects { 68 namespace tracked_objects {
91 struct ProcessDataSnapshot; 69 struct ProcessDataSnapshot;
92 } 70 }
93 71
94 // A Field Trial and its selected group, which represent a particular 72 // A Field Trial and its selected group, which represent a particular
95 // Chrome configuration state. For example, the trial name could map to 73 // Chrome configuration state. For example, the trial name could map to
96 // a preference name, and the group name could map to a preference value. 74 // a preference name, and the group name could map to a preference value.
97 struct SyntheticTrialGroup { 75 struct SyntheticTrialGroup {
98 public: 76 public:
99 ~SyntheticTrialGroup(); 77 ~SyntheticTrialGroup();
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 static ShutdownCleanliness clean_shutdown_status_; 561 static ShutdownCleanliness clean_shutdown_status_;
584 562
585 // Field trial groups that map to Chrome configuration states. 563 // Field trial groups that map to Chrome configuration states.
586 SyntheticTrialGroups synthetic_trial_groups_; 564 SyntheticTrialGroups synthetic_trial_groups_;
587 565
588 ObserverList<MetricsServiceObserver> observers_; 566 ObserverList<MetricsServiceObserver> observers_;
589 567
590 // Confirms single-threaded access to |observers_| in debug builds. 568 // Confirms single-threaded access to |observers_| in debug builds.
591 base::ThreadChecker thread_checker_; 569 base::ThreadChecker thread_checker_;
592 570
593 friend class MetricsServiceHelper; 571 friend class ChromeMetricsServiceAccessor;
594 572
595 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); 573 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess);
596 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, MetricsServiceObserver); 574 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, MetricsServiceObserver);
597 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, 575 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest,
598 PermutedEntropyCacheClearedWhenLowEntropyReset); 576 PermutedEntropyCacheClearedWhenLowEntropyReset);
599 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); 577 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial);
600 578
601 DISALLOW_COPY_AND_ASSIGN(MetricsService); 579 DISALLOW_COPY_AND_ASSIGN(MetricsService);
602 }; 580 };
603 581
604 // This class limits and documents access to metrics service helper methods.
605 // Since these methods are private, each user has to be explicitly declared
606 // as a 'friend' below.
607 class MetricsServiceHelper {
608 private:
609 friend bool prerender::IsOmniboxEnabled(Profile* profile);
610 friend class ::ChromeBrowserMetricsServiceObserver;
611 friend class ChromeRenderMessageFilter;
612 friend class ::CrashesDOMHandler;
613 friend class extensions::ExtensionDownloader;
614 friend class extensions::ManifestFetchData;
615 friend class extensions::MetricsPrivateGetIsCrashReportingEnabledFunction;
616 friend class ::FlashDOMHandler;
617 friend class system_logs::ChromeInternalLogSource;
618 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, MetricsReportingEnabled);
619 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CrashReportingEnabled);
620
621 // Returns true if prefs::kMetricsReportingEnabled is set.
622 // TODO(asvitkine): Consolidate the method in MetricsStateManager.
623 // TODO(asvitkine): This function does not report the correct value on
624 // Android and ChromeOS, see http://crbug.com/362192.
625 static bool IsMetricsReportingEnabled();
626
627 // Returns true if crash reporting is enabled. This is set at the platform
628 // level for Android and ChromeOS, and otherwise is the same as
629 // IsMetricsReportingEnabled for desktop Chrome.
630 static bool IsCrashReportingEnabled();
631
632 // Registers/unregisters |observer| to receive MetricsLog notifications
633 // from metrics service.
634 static void AddMetricsServiceObserver(MetricsServiceObserver* observer);
635 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer);
636
637 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper);
638 };
639
640 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 582 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698