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 2f6ce6356e20b0887005d98542ec8c9338fdc875..b6d8797915ae1f885153ae093e6cc8b366d705f6 100644 |
--- a/components/autofill/browser/autocomplete_history_manager.cc |
+++ b/components/autofill/browser/autocomplete_history_manager.cc |
@@ -10,11 +10,11 @@ |
#include "base/strings/string16.h" |
#include "base/strings/utf_string_conversions.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/common/autofill_messages.h" |
#include "components/autofill/common/autofill_pref_names.h" |
#include "components/autofill/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" |
@@ -42,17 +42,17 @@ bool IsTextField(const FormFieldData& field) { |
} // namespace |
AutocompleteHistoryManager::AutocompleteHistoryManager( |
- WebContents* web_contents) |
+ WebContents* web_contents, |
+ autofill::AutofillManagerDelegate* const manager_delegate) |
: content::WebContentsObserver(web_contents), |
browser_context_(web_contents->GetBrowserContext()), |
autofill_data_( |
AutofillWebDataService::FromBrowserContext(browser_context_)), |
pending_query_handle_(0), |
query_id_(0), |
- external_delegate_(NULL) { |
- autofill_enabled_.Init( |
- prefs::kAutofillEnabled, |
- user_prefs::UserPrefs::Get(browser_context_)); |
+ external_delegate_(NULL), |
+ manager_delegate_(manager_delegate) { |
+ DCHECK(manager_delegate_); |
} |
AutocompleteHistoryManager::~AutocompleteHistoryManager() { |
@@ -76,7 +76,7 @@ void AutocompleteHistoryManager::OnWebDataServiceRequestDone( |
DCHECK(pending_query_handle_); |
pending_query_handle_ = 0; |
- if (!*autofill_enabled_) { |
+ if (!manager_delegate_->IsAutoCompleteEnabled()) { |
SendSuggestions(NULL); |
return; |
} |
@@ -112,7 +112,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; |
} |
@@ -124,9 +124,6 @@ void AutocompleteHistoryManager::OnGetAutocompleteSuggestions( |
} |
void AutocompleteHistoryManager::OnFormSubmitted(const FormData& form) { |
- if (!*autofill_enabled_) |
- return; |
Ilya Sherman
2013/06/18 05:56:25
Why did you remove this check?
sgurun-gerrit only
2013/06/19 00:16:17
weird. I have
if (!manager_delegate_->IsAutocomp
|
- |
if (browser_context_->IsOffTheRecord()) |
return; |