Chromium Code Reviews| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 void AutofillManager::OnShowPasswordGenerationPopup(const gfx::Rect& bounds) { | 680 void AutofillManager::OnShowPasswordGenerationPopup(const gfx::Rect& bounds) { |
| 681 #if defined(OS_ANDROID) | 681 #if defined(OS_ANDROID) |
| 682 NOTIMPLEMENTED(); | 682 NOTIMPLEMENTED(); |
| 683 #else | 683 #else |
| 684 Browser* browser = BrowserList::GetLastActiveWithProfile( | 684 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 685 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 685 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
| 686 browser->window()->ShowPasswordGenerationBubble(bounds); | 686 browser->window()->ShowPasswordGenerationBubble(bounds); |
| 687 #endif // #if defined(OS_ANDROID) | 687 #endif // #if defined(OS_ANDROID) |
| 688 } | 688 } |
| 689 | 689 |
| 690 void AutofillManager::RemoveAutofillProfileOrCreditCard(int unique_id) { | |
| 691 const std::vector<AutofillProfile*>& profiles = personal_data_->profiles(); | |
|
Ilya Sherman
2012/04/18 18:12:51
nit: indentation?
csharp
2012/04/19 15:33:24
Done.
| |
| 692 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); | |
| 693 const AutofillProfile* profile = NULL; | |
| 694 const CreditCard* credit_card = NULL; | |
| 695 size_t variant = 0; | |
|
Ilya Sherman
2012/04/18 18:12:51
Hmm, I wonder if we should really delete the whole
csharp
2012/04/19 15:33:24
That sounds good to me. I did a little poking arou
| |
| 696 if (!GetProfileOrCreditCard(unique_id, profiles, credit_cards, &profile, | |
| 697 &credit_card, &variant)) | |
| 698 return; | |
|
Ilya Sherman
2012/04/18 18:12:51
nit: I think we can add a NOTREACHED() to this if-
csharp
2012/04/19 15:33:24
Seems reasonable. If we get here then so thing has
| |
| 699 | |
| 700 if (!personal_data_) | |
| 701 return; | |
|
Ilya Sherman
2012/04/18 18:12:51
You already used personal_data_ above... (lines 69
csharp
2012/04/19 15:33:24
That's what I get for copy the GetProfileOrCreditC
| |
| 702 | |
| 703 if (profile) { | |
| 704 personal_data_->RemoveProfile(profile->guid()); | |
| 705 } else if (credit_card) { | |
|
Ilya Sherman
2012/04/18 18:12:51
nit: No need for the "if" part of the else stmt --
csharp
2012/04/19 15:33:24
Done.
| |
| 706 personal_data_->RemoveCreditCard(credit_card->guid()); | |
| 707 } | |
|
Ilya Sherman
2012/04/18 18:12:51
nit: No need for curly braces.
csharp
2012/04/19 15:33:24
Done.
| |
| 708 } | |
| 709 | |
| 690 void AutofillManager::OnAddPasswordFormMapping( | 710 void AutofillManager::OnAddPasswordFormMapping( |
| 691 const webkit::forms::FormField& form, | 711 const webkit::forms::FormField& form, |
| 692 const webkit::forms::PasswordFormFillData& fill_data) { | 712 const webkit::forms::PasswordFormFillData& fill_data) { |
| 693 if (external_delegate_) | 713 if (external_delegate_) |
| 694 external_delegate_->AddPasswordFormMapping(form, fill_data); | 714 external_delegate_->AddPasswordFormMapping(form, fill_data); |
| 695 } | 715 } |
| 696 | 716 |
| 697 void AutofillManager::OnShowPasswordSuggestions( | 717 void AutofillManager::OnShowPasswordSuggestions( |
| 698 const webkit::forms::FormField& field, | 718 const webkit::forms::FormField& field, |
| 699 const gfx::Rect& bounds, | 719 const gfx::Rect& bounds, |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1317 *profile_guid = IDToGUID(profile_id); | 1337 *profile_guid = IDToGUID(profile_id); |
| 1318 } | 1338 } |
| 1319 | 1339 |
| 1320 void AutofillManager::UpdateInitialInteractionTimestamp( | 1340 void AutofillManager::UpdateInitialInteractionTimestamp( |
| 1321 const TimeTicks& interaction_timestamp) { | 1341 const TimeTicks& interaction_timestamp) { |
| 1322 if (initial_interaction_timestamp_.is_null() || | 1342 if (initial_interaction_timestamp_.is_null() || |
| 1323 interaction_timestamp < initial_interaction_timestamp_) { | 1343 interaction_timestamp < initial_interaction_timestamp_) { |
| 1324 initial_interaction_timestamp_ = interaction_timestamp; | 1344 initial_interaction_timestamp_ = interaction_timestamp; |
| 1325 } | 1345 } |
| 1326 } | 1346 } |
| OLD | NEW |