| 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/autofill/autofill_manager.h" | 5 #include "chrome/browser/autofill/autofill_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/autocomplete_history_manager.h" | 21 #include "chrome/browser/autocomplete_history_manager.h" |
| 22 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 22 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
| 23 #include "chrome/browser/autofill/autofill_external_delegate.h" | 23 #include "chrome/browser/autofill/autofill_external_delegate.h" |
| 24 #include "chrome/browser/autofill/autofill_feedback_infobar_delegate.h" | 24 #include "chrome/browser/autofill/autofill_feedback_infobar_delegate.h" |
| 25 #include "chrome/browser/autofill/autofill_field.h" | 25 #include "chrome/browser/autofill/autofill_field.h" |
| 26 #include "chrome/browser/autofill/autofill_metrics.h" | 26 #include "chrome/browser/autofill/autofill_metrics.h" |
| 27 #include "chrome/browser/autofill/autofill_profile.h" | 27 #include "chrome/browser/autofill/autofill_profile.h" |
| 28 #include "chrome/browser/autofill/autofill_type.h" | 28 #include "chrome/browser/autofill/autofill_type.h" |
| 29 #include "chrome/browser/autofill/credit_card.h" | 29 #include "chrome/browser/autofill/credit_card.h" |
| 30 #include "chrome/browser/autofill/form_structure.h" | 30 #include "chrome/browser/autofill/form_structure.h" |
| 31 #include "chrome/browser/autofill/password_generator.h" |
| 31 #include "chrome/browser/autofill/personal_data_manager.h" | 32 #include "chrome/browser/autofill/personal_data_manager.h" |
| 32 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 33 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 33 #include "chrome/browser/autofill/phone_number.h" | 34 #include "chrome/browser/autofill/phone_number.h" |
| 34 #include "chrome/browser/autofill/phone_number_i18n.h" | 35 #include "chrome/browser/autofill/phone_number_i18n.h" |
| 35 #include "chrome/browser/autofill/select_control_handler.h" | 36 #include "chrome/browser/autofill/select_control_handler.h" |
| 36 #include "chrome/browser/infobars/infobar_tab_helper.h" | 37 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 37 #include "chrome/browser/password_manager/password_manager.h" | 38 #include "chrome/browser/password_manager/password_manager.h" |
| 38 #include "chrome/browser/prefs/pref_service.h" | 39 #include "chrome/browser/prefs/pref_service.h" |
| 39 #include "chrome/browser/profiles/profile.h" | 40 #include "chrome/browser/profiles/profile.h" |
| 40 #include "chrome/browser/sync/profile_sync_service_factory.h" | 41 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 } | 713 } |
| 713 } | 714 } |
| 714 | 715 |
| 715 void AutofillManager::OnHideAutofillPopup() { | 716 void AutofillManager::OnHideAutofillPopup() { |
| 716 if (external_delegate_) | 717 if (external_delegate_) |
| 717 external_delegate_->HideAutofillPopup(); | 718 external_delegate_->HideAutofillPopup(); |
| 718 } | 719 } |
| 719 | 720 |
| 720 void AutofillManager::OnShowPasswordGenerationPopup( | 721 void AutofillManager::OnShowPasswordGenerationPopup( |
| 721 const gfx::Rect& bounds, | 722 const gfx::Rect& bounds, |
| 723 int max_length, |
| 722 const webkit::forms::PasswordForm& form) { | 724 const webkit::forms::PasswordForm& form) { |
| 723 #if defined(OS_ANDROID) | 725 #if defined(OS_ANDROID) |
| 724 NOTIMPLEMENTED(); | 726 NOTIMPLEMENTED(); |
| 725 #else | 727 #else |
| 726 Browser* browser = browser::FindLastActiveWithProfile( | 728 Browser* browser = browser::FindLastActiveWithProfile( |
| 727 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 729 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
| 728 browser->window()->ShowPasswordGenerationBubble(bounds, form); | 730 password_generator_.reset(new autofill::PasswordGenerator(max_length)); |
| 731 browser->window()->ShowPasswordGenerationBubble( |
| 732 bounds, password_generator_.get(), form); |
| 729 #endif // #if defined(OS_ANDROID) | 733 #endif // #if defined(OS_ANDROID) |
| 730 } | 734 } |
| 731 | 735 |
| 732 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { | 736 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { |
| 733 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); | 737 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); |
| 734 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); | 738 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); |
| 735 const AutofillProfile* profile = NULL; | 739 const AutofillProfile* profile = NULL; |
| 736 const CreditCard* credit_card = NULL; | 740 const CreditCard* credit_card = NULL; |
| 737 size_t variant = 0; | 741 size_t variant = 0; |
| 738 if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile, | 742 if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile, |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 *profile_guid = IDToGUID(profile_id); | 1388 *profile_guid = IDToGUID(profile_id); |
| 1385 } | 1389 } |
| 1386 | 1390 |
| 1387 void AutofillManager::UpdateInitialInteractionTimestamp( | 1391 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1388 const TimeTicks& interaction_timestamp) { | 1392 const TimeTicks& interaction_timestamp) { |
| 1389 if (initial_interaction_timestamp_.is_null() || | 1393 if (initial_interaction_timestamp_.is_null() || |
| 1390 interaction_timestamp < initial_interaction_timestamp_) { | 1394 interaction_timestamp < initial_interaction_timestamp_) { |
| 1391 initial_interaction_timestamp_ = interaction_timestamp; | 1395 initial_interaction_timestamp_ = interaction_timestamp; |
| 1392 } | 1396 } |
| 1393 } | 1397 } |
| OLD | NEW |