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

Unified Diff: chrome/browser/autofill/autofill_download.cc

Issue 10919066: Use BrowserContext as key in API. Switch Autofill to use BC in place of Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to parent Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/autofill_download.h ('k') | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_download.cc
diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc
index 46c7707dec06aeeefb8920e314b772fb7c9b681e..484ae71772ea395e9d1c154aa1c86c3b40a357f1 100644
--- a/chrome/browser/autofill/autofill_download.cc
+++ b/chrome/browser/autofill/autofill_download.cc
@@ -16,14 +16,16 @@
#include "chrome/browser/autofill/autofill_xml_parser.h"
#include "chrome/browser/autofill/form_structure.h"
#include "chrome/browser/api/prefs/pref_service_base.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
+#include "content/public/browser/browser_context.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_fetcher.h"
#include "third_party/libjingle/source/talk/xmllite/xmlparser.h"
+using content::BrowserContext;
+
namespace {
const char kAutofillQueryServerRequestUrl[] =
"https://clients1.google.com/tbproxy/af/query?client=";
@@ -45,9 +47,9 @@ struct AutofillDownloadManager::FormRequestData {
AutofillRequestType request_type;
};
-AutofillDownloadManager::AutofillDownloadManager(Profile* profile,
+AutofillDownloadManager::AutofillDownloadManager(BrowserContext* context,
Observer* observer)
- : profile_(profile),
+ : browser_context_(context),
observer_(observer),
max_form_cache_size_(kMaxFormCacheSize),
next_query_request_(base::Time::Now()),
@@ -56,7 +58,7 @@ AutofillDownloadManager::AutofillDownloadManager(Profile* profile,
negative_upload_rate_(0),
fetcher_id_for_unittest_(0) {
DCHECK(observer_);
- PrefServiceBase* preferences = PrefServiceBase::ForProfile(profile_);
+ PrefServiceBase* preferences = PrefServiceBase::ForContext(browser_context_);
positive_upload_rate_ =
preferences->GetDouble(prefs::kAutofillPositiveUploadRate);
negative_upload_rate_ =
@@ -143,7 +145,7 @@ void AutofillDownloadManager::SetPositiveUploadRate(double rate) {
positive_upload_rate_ = rate;
DCHECK_GE(rate, 0.0);
DCHECK_LE(rate, 1.0);
- PrefServiceBase* preferences = PrefServiceBase::ForProfile(profile_);
+ PrefServiceBase* preferences = PrefServiceBase::ForContext(browser_context_);
preferences->SetDouble(prefs::kAutofillPositiveUploadRate, rate);
}
@@ -153,14 +155,15 @@ void AutofillDownloadManager::SetNegativeUploadRate(double rate) {
negative_upload_rate_ = rate;
DCHECK_GE(rate, 0.0);
DCHECK_LE(rate, 1.0);
- PrefServiceBase* preferences = PrefServiceBase::ForProfile(profile_);
+ PrefServiceBase* preferences = PrefServiceBase::ForContext(browser_context_);
preferences->SetDouble(prefs::kAutofillNegativeUploadRate, rate);
}
bool AutofillDownloadManager::StartRequest(
const std::string& form_xml,
const FormRequestData& request_data) {
- net::URLRequestContextGetter* request_context = profile_->GetRequestContext();
+ net::URLRequestContextGetter* request_context =
+ browser_context_->GetRequestContext();
DCHECK(request_context);
std::string request_url;
if (request_data.request_type == AutofillDownloadManager::REQUEST_QUERY)
« no previous file with comments | « chrome/browser/autofill/autofill_download.h ('k') | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698