Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 case ADDRESS_HOME_COUNTRY: | 680 case ADDRESS_HOME_COUNTRY: |
| 681 return &country_combobox_model_; | 681 return &country_combobox_model_; |
| 682 | 682 |
| 683 default: | 683 default: |
| 684 return NULL; | 684 return NULL; |
| 685 } | 685 } |
| 686 } | 686 } |
| 687 | 687 |
| 688 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForSection( | 688 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForSection( |
| 689 DialogSection section) { | 689 DialogSection section) { |
| 690 return SuggestionsMenuModelForSection(section); | 690 SuggestionsMenuModel* model = SuggestionsMenuModelForSection(section); |
| 691 // The shipping section menu is special. It will always show because there is | |
| 692 // a choice between "Use billing" and "enter new". | |
| 693 if (section == SECTION_SHIPPING) | |
| 694 return model; | |
| 695 | |
| 696 // For other sections, only show a menu if there's at least one suggestion. | |
| 697 for (int i = 0; i < model->GetItemCount(); ++i) { | |
| 698 if (IsASuggestionItemKey(model->GetItemKeyAt(i))) | |
| 699 return model; | |
| 700 } | |
| 701 | |
| 702 return NULL; | |
|
aruslan
2013/04/30 16:37:28
On Android the editing form is shown only when the
| |
| 691 } | 703 } |
| 692 | 704 |
| 693 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForAccountChooser() { | 705 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForAccountChooser() { |
| 694 // If there were unrecoverable Wallet errors, or if there are choices other | 706 // If there were unrecoverable Wallet errors, or if there are choices other |
| 695 // than "Pay without the wallet", show the full menu. | 707 // than "Pay without the wallet", show the full menu. |
| 696 if (account_chooser_model_.had_wallet_error() || | 708 if (account_chooser_model_.had_wallet_error() || |
| 697 account_chooser_model_.HasAccountsToChoose()) { | 709 account_chooser_model_.HasAccountsToChoose()) { |
| 698 return &account_chooser_model_; | 710 return &account_chooser_model_; |
| 699 } | 711 } |
| 700 | 712 |
| (...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2373 url, | 2385 url, |
| 2374 content::PAGE_TRANSITION_AUTO_BOOKMARK); | 2386 content::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 2375 params.disposition = NEW_FOREGROUND_TAB; | 2387 params.disposition = NEW_FOREGROUND_TAB; |
| 2376 chrome::Navigate(¶ms); | 2388 chrome::Navigate(¶ms); |
| 2377 #else | 2389 #else |
| 2378 // TODO(estade): use TabModelList? | 2390 // TODO(estade): use TabModelList? |
| 2379 #endif | 2391 #endif |
| 2380 } | 2392 } |
| 2381 | 2393 |
| 2382 } // namespace autofill | 2394 } // namespace autofill |
| OLD | NEW |