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

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

Issue 10908065: Introduce a couple of abstract bases for WebDataService. (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 042e83783667e2055044fb29b0fe0ac13d914264..fb01eefd48193562e750c1f9cb5388ca8ba0954a 100644
--- a/chrome/browser/autofill/autocomplete_history_manager.cc
+++ b/chrome/browser/autofill/autocomplete_history_manager.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/autofill/autofill_external_delegate.h"
#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/autofill_messages.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/render_view_host.h"
@@ -116,8 +115,7 @@ AutocompleteHistoryManager::AutocompleteHistoryManager(
external_delegate_(NULL) {
profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext());
// May be NULL in unit tests.
- web_data_service_ = WebDataServiceFactory::GetForProfile(
- profile_, Profile::EXPLICIT_ACCESS);
+ web_data_service_ = WebDataServiceBase::ForProfile(profile_);
erikwright (departed) 2012/09/04 17:43:50 Why go through WebDataServiceBase? Why not have Au
Jói 2012/09/06 01:17:27 As discussed, there are common bits in WebDataServ
autofill_enabled_.Init(
prefs::kAutofillEnabled, PrefServiceBase::ForProfile(profile_), NULL);
}
@@ -138,7 +136,7 @@ bool AutocompleteHistoryManager::OnMessageReceived(
}
void AutocompleteHistoryManager::OnWebDataServiceRequestDone(
- WebDataService::Handle h,
+ WebDataServiceBase::Handle h,
const WDTypedResult* result) {
DCHECK(pending_query_handle_);
pending_query_handle_ = 0;
@@ -184,8 +182,8 @@ void AutocompleteHistoryManager::OnGetAutocompleteSuggestions(
return;
}
- if (web_data_service_.get()) {
- pending_query_handle_ = web_data_service_->GetFormValuesForElementName(
+ if (autofill_data()) {
+ pending_query_handle_ = autofill_data()->GetFormValuesForElementName(
name, prefix, kMaxAutocompleteMenuItems, this);
}
}
@@ -220,14 +218,14 @@ void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) {
}
}
- if (!values.empty() && web_data_service_.get())
- web_data_service_->AddFormFields(values);
+ if (!values.empty() && autofill_data())
+ autofill_data()->AddFormFields(values);
}
void AutocompleteHistoryManager::OnRemoveAutocompleteEntry(
const string16& name, const string16& value) {
- if (web_data_service_.get())
- web_data_service_->RemoveFormValueForElementName(name, value);
+ if (autofill_data())
+ autofill_data()->RemoveFormValueForElementName(name, value);
}
void AutocompleteHistoryManager::SetExternalDelegate(
@@ -238,7 +236,7 @@ void AutocompleteHistoryManager::SetExternalDelegate(
AutocompleteHistoryManager::AutocompleteHistoryManager(
WebContents* web_contents,
Profile* profile,
- WebDataService* wds)
+ WebDataServiceBase* wds)
: content::WebContentsObserver(web_contents),
profile_(profile),
web_data_service_(wds),
@@ -252,7 +250,7 @@ AutocompleteHistoryManager::AutocompleteHistoryManager(
void AutocompleteHistoryManager::CancelPendingQuery() {
if (pending_query_handle_) {
SendSuggestions(NULL);
- if (web_data_service_.get())
+ if (web_data_service_)
web_data_service_->CancelRequest(pending_query_handle_);
pending_query_handle_ = 0;
}

Powered by Google App Engine
This is Rietveld 408576698