OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" | 5 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h" | 9 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h" |
10 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 10 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (popup_controller_.get()) | 164 if (popup_controller_.get()) |
165 popup_controller_->Hide(); | 165 popup_controller_->Hide(); |
166 } | 166 } |
167 | 167 |
168 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { | 168 void TabAutofillManagerDelegate::UpdateProgressBar(double value) { |
169 // |dialog_controller_| is a WeakPtr, but we require it to be present when | 169 // |dialog_controller_| is a WeakPtr, but we require it to be present when |
170 // |UpdateProgressBar| is called, so we intentionally do not do NULL check. | 170 // |UpdateProgressBar| is called, so we intentionally do not do NULL check. |
171 dialog_controller_->UpdateProgressBar(value); | 171 dialog_controller_->UpdateProgressBar(value); |
172 } | 172 } |
173 | 173 |
| 174 bool TabAutofillManagerDelegate::IsAutoCompleteEnabled() { |
| 175 // For browser, Autocomplete is always enabled as part of Autofill. |
| 176 return GetPrefs()->GetBoolean(prefs::kAutofillEnabled); |
| 177 } |
| 178 |
174 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { | 179 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { |
175 if (dialog_controller_.get()) | 180 if (dialog_controller_.get()) |
176 dialog_controller_->Hide(); | 181 dialog_controller_->Hide(); |
177 } | 182 } |
178 | 183 |
179 void TabAutofillManagerDelegate::DidNavigateMainFrame( | 184 void TabAutofillManagerDelegate::DidNavigateMainFrame( |
180 const content::LoadCommittedDetails& details, | 185 const content::LoadCommittedDetails& details, |
181 const content::FrameNavigateParams& params) { | 186 const content::FrameNavigateParams& params) { |
182 // A redirect immediately after a successful Autocheckout flow shouldn't hide | 187 // A redirect immediately after a successful Autocheckout flow shouldn't hide |
183 // the dialog. | 188 // the dialog. |
184 bool was_redirect = details.entry && | 189 bool was_redirect = details.entry && |
185 content::PageTransitionIsRedirect(details.entry->GetTransitionType()); | 190 content::PageTransitionIsRedirect(details.entry->GetTransitionType()); |
186 if (dialog_controller_.get() && | 191 if (dialog_controller_.get() && |
187 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || | 192 (dialog_controller_->dialog_type() == DIALOG_TYPE_REQUEST_AUTOCOMPLETE || |
188 (!dialog_controller_->AutocheckoutIsRunning() && !was_redirect))) { | 193 (!dialog_controller_->AutocheckoutIsRunning() && !was_redirect))) { |
189 HideRequestAutocompleteDialog(); | 194 HideRequestAutocompleteDialog(); |
190 } | 195 } |
191 | 196 |
192 HideAutocheckoutBubble(); | 197 HideAutocheckoutBubble(); |
193 } | 198 } |
194 | 199 |
195 } // namespace autofill | 200 } // namespace autofill |
OLD | NEW |