Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/autofill/autofill_manager.cc

Issue 10458018: This CL does the following: (1) Pass the max_length attribute to the password generator; (2) Update… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make password generator independent of platforms. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 scoped_ptr<autofill::PasswordGenerator> password_generator(
729 new autofill::PasswordGenerator(max_length));
Ilya Sherman 2012/06/01 01:09:55 This will be deleted immediately at the end of the
zysxqn 2012/06/01 19:01:32 I don't think it's a problem here. Only when user
Garrett Casto 2012/06/01 20:02:02 I don't think that either of these solutions is re
zysxqn 2012/06/01 22:32:54 Done.
730 browser->window()->ShowPasswordGenerationBubble(
731 bounds, password_generator.get());
727 #endif // #if defined(OS_ANDROID) 732 #endif // #if defined(OS_ANDROID)
728 } 733 }
729 734
730 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { 735 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) {
731 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); 736 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles();
732 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); 737 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards();
733 const AutofillProfile* profile = NULL; 738 const AutofillProfile* profile = NULL;
734 const CreditCard* credit_card = NULL; 739 const CreditCard* credit_card = NULL;
735 size_t variant = 0; 740 size_t variant = 0;
736 if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile, 741 if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile,
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 *profile_guid = IDToGUID(profile_id); 1387 *profile_guid = IDToGUID(profile_id);
1383 } 1388 }
1384 1389
1385 void AutofillManager::UpdateInitialInteractionTimestamp( 1390 void AutofillManager::UpdateInitialInteractionTimestamp(
1386 const TimeTicks& interaction_timestamp) { 1391 const TimeTicks& interaction_timestamp) {
1387 if (initial_interaction_timestamp_.is_null() || 1392 if (initial_interaction_timestamp_.is_null() ||
1388 interaction_timestamp < initial_interaction_timestamp_) { 1393 interaction_timestamp < initial_interaction_timestamp_) {
1389 initial_interaction_timestamp_ = interaction_timestamp; 1394 initial_interaction_timestamp_ = interaction_timestamp;
1390 } 1395 }
1391 } 1396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698