summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 21:59:53 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-30 21:59:53 +0000
commit975bead0d4a441b838950e7ca1c0f1dff1cb22c8 (patch)
tree74551561a5c73f65655aba492a383ef0b923ac79
parentfc677875ab6319907a3fd5c1324c427a6b26e254 (diff)
downloadchromium_src-975bead0d4a441b838950e7ca1c0f1dff1cb22c8.zip
chromium_src-975bead0d4a441b838950e7ca1c0f1dff1cb22c8.tar.gz
chromium_src-975bead0d4a441b838950e7ca1c0f1dff1cb22c8.tar.bz2
Remove another instance of using the transient pref service. This pref
is only read from the options dialog, the windows installer (a separate process) and a spot in safe browsing. The only one that matters is the safe browsing case. BUG=28992 Review URL: http://codereview.chromium.org/456004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33348 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_main.cc4
-rw-r--r--chrome/browser/metrics/metrics_service.h5
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc7
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();