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

Unified Diff: components/autofill/core/browser/autofill_download.cc

Issue 49303005: Parameterize the PrefService that AutofillDownloadManager uses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test, introduce PrefService testing helper Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_download.cc
diff --git a/components/autofill/core/browser/autofill_download.cc b/components/autofill/core/browser/autofill_download.cc
index 9bf81e2c72bbcb71c64492e642ff9cee3f67eb06..994db7161eac34ae63ffd210af2208777b1080a0 100644
--- a/components/autofill/core/browser/autofill_download.cc
+++ b/components/autofill/core/browser/autofill_download.cc
@@ -18,7 +18,6 @@
#include "components/autofill/core/browser/autofill_xml_parser.h"
#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/common/autofill_pref_names.h"
-#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_context.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
@@ -70,8 +69,10 @@ struct AutofillDownloadManager::FormRequestData {
};
AutofillDownloadManager::AutofillDownloadManager(BrowserContext* context,
+ PrefService* pref_service,
Observer* observer)
: browser_context_(context),
+ pref_service_(pref_service),
observer_(observer),
max_form_cache_size_(kMaxFormCacheSize),
next_query_request_(base::Time::Now()),
@@ -80,11 +81,10 @@ AutofillDownloadManager::AutofillDownloadManager(BrowserContext* context,
negative_upload_rate_(0),
fetcher_id_for_unittest_(0) {
DCHECK(observer_);
- PrefService* preferences = user_prefs::UserPrefs::Get(browser_context_);
positive_upload_rate_ =
- preferences->GetDouble(prefs::kAutofillPositiveUploadRate);
+ pref_service_->GetDouble(prefs::kAutofillPositiveUploadRate);
negative_upload_rate_ =
- preferences->GetDouble(prefs::kAutofillNegativeUploadRate);
+ pref_service_->GetDouble(prefs::kAutofillNegativeUploadRate);
}
AutofillDownloadManager::~AutofillDownloadManager() {
@@ -170,8 +170,7 @@ void AutofillDownloadManager::SetPositiveUploadRate(double rate) {
positive_upload_rate_ = rate;
DCHECK_GE(rate, 0.0);
DCHECK_LE(rate, 1.0);
- PrefService* preferences = user_prefs::UserPrefs::Get(browser_context_);
- preferences->SetDouble(prefs::kAutofillPositiveUploadRate, rate);
+ pref_service_->SetDouble(prefs::kAutofillPositiveUploadRate, rate);
}
void AutofillDownloadManager::SetNegativeUploadRate(double rate) {
@@ -180,8 +179,7 @@ void AutofillDownloadManager::SetNegativeUploadRate(double rate) {
negative_upload_rate_ = rate;
DCHECK_GE(rate, 0.0);
DCHECK_LE(rate, 1.0);
- PrefService* preferences = user_prefs::UserPrefs::Get(browser_context_);
- preferences->SetDouble(prefs::kAutofillNegativeUploadRate, rate);
+ pref_service_->SetDouble(prefs::kAutofillNegativeUploadRate, rate);
}
bool AutofillDownloadManager::StartRequest(

Powered by Google App Engine
This is Rietveld 408576698