diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_main.cc | 4 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.h | 5 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.cc | 7 |
3 files changed, 7 insertions, 9 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 2b9d0ad..5ea61f6 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -839,10 +839,6 @@ int BrowserMain(const MainFunctionParams& parameters) { enabled = false; #endif - if (record_only) { - local_state->transient()->SetBoolean(prefs::kMetricsReportingEnabled, - false); - } metrics = browser_process->metrics_service(); DCHECK(metrics); diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index b66d36e..516dd4c 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -130,6 +130,9 @@ class MetricsService : public NotificationObserver, void StartExternalMetrics(Profile* profile); #endif + bool recording_active() const; + bool reporting_active() const; + private: // The MetricsService has a lifecycle that is stored as a state. // See metrics_service.cc for description of this lifecycle. @@ -158,7 +161,6 @@ class MetricsService : public NotificationObserver, // SetRecording(false) also forces a persistent save of logging state (if // anything has been recorded, or transmitted). void SetRecording(bool enabled); - bool recording_active() const; // Enable/disable transmission of accumulated logs and crash reports (dumps). // Return value "true" indicates setting was definitively set as requested). @@ -169,7 +171,6 @@ class MetricsService : public NotificationObserver, // It is always possible to set this to at least one value, which matches the // current value reported by querying Google Update. void SetReporting(bool enabled); - bool reporting_active() const; // If in_idle is true, sets idle_since_last_transmission to true. // If in_idle is false and idle_since_last_transmission_ is true, sets diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 236791f..5b38aab 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -8,6 +8,7 @@ #include "base/path_service.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/metrics/metrics_service.h" #include "chrome/browser/net/url_request_context_getter.h" #include "chrome/browser/profile_manager.h" #include "chrome/browser/safe_browsing/protocol_manager.h" @@ -696,9 +697,9 @@ void SafeBrowsingService::DoDisplayBlockingPage( // Report the malware sub-resource to the SafeBrowsing servers if we have a // malware sub-resource on a safe page and only if the user has opted in to // reporting statistics. - PrefService* prefs = g_browser_process->local_state(); - DCHECK(prefs); - if (prefs && prefs->GetBoolean(prefs::kMetricsReportingEnabled) && + const MetricsService* metrics = g_browser_process->metrics_service(); + DCHECK(metrics); + if (metrics && metrics->reporting_active() && resource.resource_type != ResourceType::MAIN_FRAME && resource.threat_type == SafeBrowsingService::URL_MALWARE) { GURL page_url = wc->GetURL(); |