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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
710 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); | 711 AutofillMetrics::SUGGESTIONS_SHOWN_ONCE); |
711 } | 712 } |
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(const gfx::Rect& bounds) { | 721 void AutofillManager::OnShowPasswordGenerationPopup(const gfx::Rect& bounds, |
722 int max_length) { | |
721 #if defined(OS_ANDROID) | 723 #if defined(OS_ANDROID) |
722 NOTIMPLEMENTED(); | 724 NOTIMPLEMENTED(); |
723 #else | 725 #else |
724 Browser* browser = browser::FindLastActiveWithProfile( | 726 Browser* browser = browser::FindLastActiveWithProfile( |
725 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 727 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
726 browser->window()->ShowPasswordGenerationBubble(bounds); | 728 password_generator_.reset(new autofill::PasswordGenerator(max_length)); |
729 browser->window()->ShowPasswordGenerationBubble( | |
730 bounds, password_generator_.get()); | |
Ilya Sherman
2012/06/04 22:52:32
Is this bubble guaranteed to be hidden prior to th
Garrett Casto
2012/06/04 22:58:57
At the moment the bubble is closed as soon as it l
| |
727 #endif // #if defined(OS_ANDROID) | 731 #endif // #if defined(OS_ANDROID) |
728 } | 732 } |
729 | 733 |
730 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { | 734 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { |
731 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); | 735 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); |
732 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); | 736 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); |
733 const AutofillProfile* profile = NULL; | 737 const AutofillProfile* profile = NULL; |
734 const CreditCard* credit_card = NULL; | 738 const CreditCard* credit_card = NULL; |
735 size_t variant = 0; | 739 size_t variant = 0; |
736 if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile, | 740 if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile, |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1382 *profile_guid = IDToGUID(profile_id); | 1386 *profile_guid = IDToGUID(profile_id); |
1383 } | 1387 } |
1384 | 1388 |
1385 void AutofillManager::UpdateInitialInteractionTimestamp( | 1389 void AutofillManager::UpdateInitialInteractionTimestamp( |
1386 const TimeTicks& interaction_timestamp) { | 1390 const TimeTicks& interaction_timestamp) { |
1387 if (initial_interaction_timestamp_.is_null() || | 1391 if (initial_interaction_timestamp_.is_null() || |
1388 interaction_timestamp < initial_interaction_timestamp_) { | 1392 interaction_timestamp < initial_interaction_timestamp_) { |
1389 initial_interaction_timestamp_ = interaction_timestamp; | 1393 initial_interaction_timestamp_ = interaction_timestamp; |
1390 } | 1394 } |
1391 } | 1395 } |
OLD | NEW |