Chromium Code Reviews| Index: components/autofill/browser/autocomplete_history_manager.cc |
| diff --git a/components/autofill/browser/autocomplete_history_manager.cc b/components/autofill/browser/autocomplete_history_manager.cc |
| index efe5296325119a1c231008e7de15b8b98c31c61e..2e43e457ec7d4e1fcefe7eb8e0242045279891af 100644 |
| --- a/components/autofill/browser/autocomplete_history_manager.cc |
| +++ b/components/autofill/browser/autocomplete_history_manager.cc |
| @@ -11,11 +11,11 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "components/autofill/browser/autofill_driver.h" |
| #include "components/autofill/browser/autofill_external_delegate.h" |
| +#include "components/autofill/browser/autofill_manager_delegate.h" |
| #include "components/autofill/browser/validation.h" |
| #include "components/autofill/core/common/autofill_messages.h" |
| #include "components/autofill/core/common/autofill_pref_names.h" |
| #include "components/autofill/core/common/form_data.h" |
| -#include "components/user_prefs/user_prefs.h" |
| #include "content/public/browser/browser_context.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| @@ -43,7 +43,9 @@ bool IsTextField(const FormFieldData& field) { |
| } // namespace |
| -AutocompleteHistoryManager::AutocompleteHistoryManager(AutofillDriver* driver) |
| +AutocompleteHistoryManager::AutocompleteHistoryManager( |
| + AutofillDriver* driver, |
| + autofill::AutofillManagerDelegate* manager_delegate) |
|
Ilya Sherman
2013/06/19 00:38:27
nit: This code is already in the autofill:: namesp
sgurun-gerrit only
2013/06/19 17:56:23
Done.
|
| : browser_context_(driver->GetWebContents()->GetBrowserContext()), |
| driver_(driver), |
| autofill_data_( |
| @@ -51,10 +53,9 @@ AutocompleteHistoryManager::AutocompleteHistoryManager(AutofillDriver* driver) |
| pending_query_handle_(0), |
| query_id_(0), |
| external_delegate_(NULL), |
| + manager_delegate_(manager_delegate), |
| send_ipc_(true) { |
| - autofill_enabled_.Init( |
| - prefs::kAutofillEnabled, |
| - user_prefs::UserPrefs::Get(browser_context_)); |
| + DCHECK(manager_delegate_); |
| } |
| AutocompleteHistoryManager::~AutocompleteHistoryManager() { |
| @@ -67,7 +68,7 @@ void AutocompleteHistoryManager::OnWebDataServiceRequestDone( |
| DCHECK(pending_query_handle_); |
| pending_query_handle_ = 0; |
| - if (!*autofill_enabled_) { |
| + if (!manager_delegate_->IsAutocompleteEnabled()) { |
| SendSuggestions(NULL); |
| return; |
| } |
| @@ -103,7 +104,7 @@ void AutocompleteHistoryManager::OnGetAutocompleteSuggestions( |
| autofill_labels_ = autofill_labels; |
| autofill_icons_ = autofill_icons; |
| autofill_unique_ids_ = autofill_unique_ids; |
| - if (!*autofill_enabled_) { |
| + if (!manager_delegate_->IsAutocompleteEnabled()) { |
| SendSuggestions(NULL); |
| return; |
| } |
| @@ -115,7 +116,7 @@ void AutocompleteHistoryManager::OnGetAutocompleteSuggestions( |
| } |
| void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) { |
| - if (!*autofill_enabled_) |
| + if (!manager_delegate_->IsAutocompleteEnabled()) |
| return; |
| if (browser_context_->IsOffTheRecord()) |