| 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..e7c1f8d36da4ff5ebd5d118b6fbbbab2729a6877 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,
|
| + AutofillManagerDelegate* manager_delegate)
|
| : 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())
|
|
|