| 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/autofill_cc_infobar_delegate.h" | 9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
| 12 #include "chrome/browser/password_manager/password_generation_manager.h" | 12 #include "chrome/browser/password_manager/password_generation_manager.h" |
| 13 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 15 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" |
| 15 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 16 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
| 20 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 21 #include "chrome/browser/webdata/web_data_service_factory.h" | 22 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 popup_controller_->UpdateDataListValues(values, labels); | 142 popup_controller_->UpdateDataListValues(values, labels); |
| 142 } | 143 } |
| 143 | 144 |
| 144 void TabAutofillManagerDelegate::HideAutofillPopup() { | 145 void TabAutofillManagerDelegate::HideAutofillPopup() { |
| 145 if (popup_controller_.get()) | 146 if (popup_controller_.get()) |
| 146 popup_controller_->Hide(); | 147 popup_controller_->Hide(); |
| 147 | 148 |
| 148 // Password generation popups behave in the same fashion and should also | 149 // Password generation popups behave in the same fashion and should also |
| 149 // be hidden. | 150 // be hidden. |
| 150 PasswordGenerationManager* generation_manager = | 151 PasswordGenerationManager* generation_manager = |
| 151 PasswordGenerationManager::FromWebContents(web_contents_); | 152 PasswordManagerDelegateImpl::GetGenerationManagerFromWebContents( |
| 153 web_contents_); |
| 152 if (generation_manager) | 154 if (generation_manager) |
| 153 generation_manager->HidePopup(); | 155 generation_manager->HidePopup(); |
| 154 } | 156 } |
| 155 | 157 |
| 156 bool TabAutofillManagerDelegate::IsAutocompleteEnabled() { | 158 bool TabAutofillManagerDelegate::IsAutocompleteEnabled() { |
| 157 // For browser, Autocomplete is always enabled as part of Autofill. | 159 // For browser, Autocomplete is always enabled as part of Autofill. |
| 158 return GetPrefs()->GetBoolean(prefs::kAutofillEnabled); | 160 return GetPrefs()->GetBoolean(prefs::kAutofillEnabled); |
| 159 } | 161 } |
| 160 | 162 |
| 161 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { | 163 void TabAutofillManagerDelegate::HideRequestAutocompleteDialog() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 180 } | 182 } |
| 181 | 183 |
| 182 void TabAutofillManagerDelegate::WebContentsDestroyed( | 184 void TabAutofillManagerDelegate::WebContentsDestroyed( |
| 183 content::WebContents* web_contents) { | 185 content::WebContents* web_contents) { |
| 184 HideAutofillPopup(); | 186 HideAutofillPopup(); |
| 185 } | 187 } |
| 186 | 188 |
| 187 void TabAutofillManagerDelegate::DetectAccountCreationForms( | 189 void TabAutofillManagerDelegate::DetectAccountCreationForms( |
| 188 const std::vector<autofill::FormStructure*>& forms) { | 190 const std::vector<autofill::FormStructure*>& forms) { |
| 189 PasswordGenerationManager* manager = | 191 PasswordGenerationManager* manager = |
| 190 PasswordGenerationManager::FromWebContents(web_contents_); | 192 PasswordManagerDelegateImpl::GetGenerationManagerFromWebContents( |
| 193 web_contents_); |
| 191 if (manager) | 194 if (manager) |
| 192 manager->DetectAccountCreationForms(forms); | 195 manager->DetectAccountCreationForms(forms); |
| 193 } | 196 } |
| 194 | 197 |
| 195 } // namespace autofill | 198 } // namespace autofill |
| OLD | NEW |