diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 18:32:04 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-13 18:32:04 +0000 |
commit | b1c8dc01ed42482d4223871947efe93ba3a5ecf1 (patch) | |
tree | ad5d10da6d90dc729ba11b468d487a1823080949 | |
parent | 839936a79332917896e43023aa749718601ea8e7 (diff) | |
download | chromium_src-b1c8dc01ed42482d4223871947efe93ba3a5ecf1.zip chromium_src-b1c8dc01ed42482d4223871947efe93ba3a5ecf1.tar.gz chromium_src-b1c8dc01ed42482d4223871947efe93ba3a5ecf1.tar.bz2 |
Remove another unnecessary MetricsService API method.
In practice, "user allows upload" and "reporting is enabled" are the same, and there's no clear conceptual difference, so remove one to make both the API and the implementation simpler.
BUG=None
TEST=Existing tests.
Review URL: http://codereview.chromium.org/6813096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81443 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_main.cc | 1 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 24 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.h | 15 | ||||
-rw-r--r-- | chrome/browser/ui/options/options_util.cc | 1 |
4 files changed, 11 insertions, 30 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index e252687..a6541b2 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -766,7 +766,6 @@ MetricsService* InitializeMetrics(const CommandLine& parsed_command_line, #else bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); #endif // #if defined(OS_CHROMEOS) - metrics->SetUserPermitsUpload(enabled); if (enabled) { metrics->Start(); chrome_browser_net_websocket_experiment:: diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 6019de5..f6ff5c0 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -438,7 +438,6 @@ void MetricsService::DiscardOldStabilityStats(PrefService* local_state) { MetricsService::MetricsService() : recording_active_(false), reporting_active_(false), - user_permits_upload_(false), server_permits_upload_(true), state_(INITIALIZED), current_fetch_(NULL), @@ -457,12 +456,8 @@ MetricsService::~MetricsService() { SetRecording(false); } -void MetricsService::SetUserPermitsUpload(bool enabled) { - HandleIdleSinceLastTransmission(false); - user_permits_upload_ = enabled; -} - void MetricsService::Start() { + HandleIdleSinceLastTransmission(false); SetRecording(true); SetReporting(true); } @@ -473,6 +468,7 @@ void MetricsService::StartRecordingOnly() { } void MetricsService::Stop() { + HandleIdleSinceLastTransmission(false); SetReporting(false); SetRecording(false); } @@ -1026,9 +1022,9 @@ void MetricsService::OnHistogramSynchronizationDone() { return; } - // If we're not supposed to upload any UMA data because the response or the - // user said so, cancel the upload at this point, but start the timer. - if (!TransmissionPermitted()) { + // If we're not supposed to upload any UMA data because the response said so, + // cancel the upload at this point, but start the timer. + if (!ServerPermitsTransmission()) { DiscardPendingLog(); StartLogTransmissionTimer(); return; @@ -1105,13 +1101,9 @@ void MetricsService::MakePendingLog() { DCHECK(pending_log()); } -bool MetricsService::TransmissionPermitted() const { - // If the user forbids uploading that's they're business, and we don't upload - // anything. If the server forbids uploading, that's our business, so we take - // that to mean it forbids current logs, but we still send up the inital logs - // and any old logs. - if (!user_permits_upload_) - return false; +bool MetricsService::ServerPermitsTransmission() const { + // If the server forbids uploading, we take that to mean it forbids current + // logs, but we still send up the inital logs and any old logs. if (server_permits_upload_) return true; diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index f7a9247..b2add89 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -79,10 +79,6 @@ class MetricsService : public NotificationObserver, MetricsService(); virtual ~MetricsService(); - // Sets whether the user permits uploading. The argument of this function - // should match the checkbox in Options. - void SetUserPermitsUpload(bool enabled); - // Start/stop the metrics recording and uploading machine. These should be // used on startup and when the user clicks the checkbox in the prefs. // StartRecordingOnly starts the metrics recording but not reporting, for use @@ -228,10 +224,9 @@ class MetricsService : public NotificationObserver, // MakePendingLog does nothing and returns. void MakePendingLog(); - // Determines from state_ and permissions set out by the server and by - // the user whether the pending_log_ should be sent or discarded. Called by - // TryToStartTransmission. - bool TransmissionPermitted() const; + // Determines from state_ and permissions set out by the server whether the + // pending_log_ should be sent or discarded. + bool ServerPermitsTransmission() const; // Check to see if there are any unsent logs from previous sessions. bool unsent_logs() const { @@ -393,10 +388,6 @@ class MetricsService : public NotificationObserver, bool recording_active_; bool reporting_active_; - // Coincides with the check box in options window that lets the user control - // whether to upload. - bool user_permits_upload_; - // The variable server_permits_upload_ is set true when the response // data forbids uploading. This should coinside with the "die roll" // with probability in the upload tag of the response data came out diff --git a/chrome/browser/ui/options/options_util.cc b/chrome/browser/ui/options/options_util.cc index 43cd7dd..bed21ab 100644 --- a/chrome/browser/ui/options/options_util.cc +++ b/chrome/browser/ui/options/options_util.cc @@ -127,7 +127,6 @@ bool OptionsUtil::ResolveMetricsReportingEnabled(bool enabled) { MetricsService* metrics = g_browser_process->metrics_service(); DCHECK(metrics); if (metrics) { - metrics->SetUserPermitsUpload(enabled); if (enabled) metrics->Start(); else |