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

Side by Side Diff: chrome/browser/ui/views/payments/profile_list_view_controller.cc

Issue 2841643002: When a new Payments address is created from the editor, use it as the chosen address (Closed)
Patch Set: And yet another small goof fix... :-( Created 3 years, 8 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/views/payments/profile_list_view_controller.h" 5 #include "chrome/browser/ui/views/payments/profile_list_view_controller.h"
6 6
7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" 7 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h"
8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" 8 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h"
9 #include "chrome/browser/ui/views/payments/payment_request_row_view.h" 9 #include "chrome/browser/ui/views/payments/payment_request_row_view.h"
10 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" 10 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 autofill::AutofillProfile* profile) override { 109 autofill::AutofillProfile* profile) override {
110 return GetShippingAddressLabel(AddressStyleType::DETAILED, 110 return GetShippingAddressLabel(AddressStyleType::DETAILED,
111 state()->GetApplicationLocale(), *profile); 111 state()->GetApplicationLocale(), *profile);
112 } 112 }
113 113
114 void SelectProfile(autofill::AutofillProfile* profile) override { 114 void SelectProfile(autofill::AutofillProfile* profile) override {
115 state()->SetSelectedShippingProfile(profile); 115 state()->SetSelectedShippingProfile(profile);
116 } 116 }
117 117
118 void ShowEditor(autofill::AutofillProfile* profile) override { 118 void ShowEditor(autofill::AutofillProfile* profile) override {
119 dialog()->ShowShippingAddressEditor(profile); 119 dialog()->ShowShippingAddressEditor(
120 /*on_edited=*/base::BindOnce(
121 &PaymentRequestState::SetSelectedShippingProfile,
122 base::Unretained(state()), profile),
123 /*on_added=*/
124 base::BindOnce(&PaymentRequestState::AddAutofillShippingProfile,
125 base::Unretained(state()), /*selected=*/true),
126 profile);
120 } 127 }
121 128
122 autofill::AutofillProfile* GetSelectedProfile() override { 129 autofill::AutofillProfile* GetSelectedProfile() override {
123 return state()->selected_shipping_profile(); 130 return state()->selected_shipping_profile();
124 } 131 }
125 132
126 std::vector<autofill::AutofillProfile*> GetProfiles() override { 133 std::vector<autofill::AutofillProfile*> GetProfiles() override {
127 return state()->shipping_profiles(); 134 return state()->shipping_profiles();
128 } 135 }
129 136
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 285
279 void ProfileListViewController::ButtonPressed(views::Button* sender, 286 void ProfileListViewController::ButtonPressed(views::Button* sender,
280 const ui::Event& event) { 287 const ui::Event& event) {
281 if (sender->tag() == GetSecondaryButtonTag()) 288 if (sender->tag() == GetSecondaryButtonTag())
282 ShowEditor(nullptr); 289 ShowEditor(nullptr);
283 else 290 else
284 PaymentRequestSheetController::ButtonPressed(sender, event); 291 PaymentRequestSheetController::ButtonPressed(sender, event);
285 } 292 }
286 293
287 } // namespace payments 294 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698