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

Unified Diff: chrome/browser/autofill/autocomplete_history_manager.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: 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
Index: chrome/browser/autofill/autocomplete_history_manager.cc
diff --git a/chrome/browser/autofill/autocomplete_history_manager.cc b/chrome/browser/autofill/autocomplete_history_manager.cc
index fb01eefd48193562e750c1f9cb5388ca8ba0954a..47fb41f436630f3ab530a64c093100341a48eb52 100644
--- a/chrome/browser/autofill/autocomplete_history_manager.cc
+++ b/chrome/browser/autofill/autocomplete_history_manager.cc
@@ -12,14 +12,15 @@
#include "chrome/browser/api/prefs/pref_service_base.h"
#include "chrome/browser/autofill/autofill_external_delegate.h"
#include "chrome/browser/autofill/credit_card.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/common/autofill_messages.h"
#include "chrome/common/pref_names.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "webkit/forms/form_data.h"
using base::StringPiece16;
+using content::BrowserContext;
using content::WebContents;
using webkit::forms::FormData;
using webkit::forms::FormField;
@@ -113,11 +114,12 @@ AutocompleteHistoryManager::AutocompleteHistoryManager(
pending_query_handle_(0),
query_id_(0),
external_delegate_(NULL) {
- profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ browser_context_ = web_contents->GetBrowserContext();
// May be NULL in unit tests.
- web_data_service_ = WebDataServiceBase::ForProfile(profile_);
- autofill_enabled_.Init(
- prefs::kAutofillEnabled, PrefServiceBase::ForProfile(profile_), NULL);
+ web_data_service_ = WebDataServiceBase::ForContext(browser_context_);
+ autofill_enabled_.Init(prefs::kAutofillEnabled,
+ PrefServiceBase::ForContext(browser_context_),
+ NULL);
}
AutocompleteHistoryManager::~AutocompleteHistoryManager() {
@@ -192,7 +194,7 @@ void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) {
if (!*autofill_enabled_)
return;
- if (profile_->IsOffTheRecord())
+ if (browser_context_->IsOffTheRecord())
return;
// Don't save data that was submitted through JavaScript.
@@ -235,16 +237,17 @@ void AutocompleteHistoryManager::SetExternalDelegate(
AutocompleteHistoryManager::AutocompleteHistoryManager(
WebContents* web_contents,
- Profile* profile,
+ BrowserContext* browser_context,
WebDataServiceBase* wds)
: content::WebContentsObserver(web_contents),
- profile_(profile),
+ browser_context_(browser_context),
web_data_service_(wds),
pending_query_handle_(0),
query_id_(0),
external_delegate_(NULL) {
- autofill_enabled_.Init(
- prefs::kAutofillEnabled, PrefServiceBase::ForProfile(profile_), NULL);
+ autofill_enabled_.Init(prefs::kAutofillEnabled,
+ PrefServiceBase::ForContext(browser_context_),
+ NULL);
}
void AutocompleteHistoryManager::CancelPendingQuery() {

Powered by Google App Engine
This is Rietveld 408576698