| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/payment_request_dialog_view.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 base::MakeUnique<CvcUnmaskViewController>( | 231 base::MakeUnique<CvcUnmaskViewController>( |
| 232 request_->spec(), request_->state(), this, | 232 request_->spec(), request_->state(), this, |
| 233 credit_card, result_delegate, web_contents), | 233 credit_card, result_delegate, web_contents), |
| 234 &controller_map_), | 234 &controller_map_), |
| 235 /* animate = */ true); | 235 /* animate = */ true); |
| 236 if (observer_for_testing_) | 236 if (observer_for_testing_) |
| 237 observer_for_testing_->OnCvcPromptShown(); | 237 observer_for_testing_->OnCvcPromptShown(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void PaymentRequestDialogView::ShowCreditCardEditor( | 240 void PaymentRequestDialogView::ShowCreditCardEditor( |
| 241 BackNavigationType back_navigation_type, |
| 242 int next_ui_tag, |
| 241 base::OnceClosure on_edited, | 243 base::OnceClosure on_edited, |
| 242 base::OnceCallback<void(const autofill::CreditCard&)> on_added, | 244 base::OnceCallback<void(const autofill::CreditCard&)> on_added, |
| 243 autofill::CreditCard* credit_card) { | 245 autofill::CreditCard* credit_card) { |
| 244 view_stack_->Push( | 246 view_stack_->Push( |
| 245 CreateViewAndInstallController( | 247 CreateViewAndInstallController( |
| 246 base::MakeUnique<CreditCardEditorViewController>( | 248 base::MakeUnique<CreditCardEditorViewController>( |
| 247 request_->spec(), request_->state(), this, std::move(on_edited), | 249 request_->spec(), request_->state(), this, back_navigation_type, |
| 248 std::move(on_added), credit_card), | 250 next_ui_tag, std::move(on_edited), std::move(on_added), |
| 251 credit_card), |
| 249 &controller_map_), | 252 &controller_map_), |
| 250 /* animate = */ true); | 253 /* animate = */ true); |
| 251 if (observer_for_testing_) | 254 if (observer_for_testing_) |
| 252 observer_for_testing_->OnCreditCardEditorOpened(); | 255 observer_for_testing_->OnCreditCardEditorOpened(); |
| 253 } | 256 } |
| 254 | 257 |
| 255 void PaymentRequestDialogView::ShowShippingAddressEditor( | 258 void PaymentRequestDialogView::ShowShippingAddressEditor( |
| 259 BackNavigationType back_navigation_type, |
| 256 base::OnceClosure on_edited, | 260 base::OnceClosure on_edited, |
| 257 base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, | 261 base::OnceCallback<void(const autofill::AutofillProfile&)> on_added, |
| 258 autofill::AutofillProfile* profile) { | 262 autofill::AutofillProfile* profile) { |
| 259 view_stack_->Push(CreateViewAndInstallController( | 263 view_stack_->Push( |
| 260 base::MakeUnique<ShippingAddressEditorViewController>( | 264 CreateViewAndInstallController( |
| 261 request_->spec(), request_->state(), this, | 265 base::MakeUnique<ShippingAddressEditorViewController>( |
| 262 std::move(on_edited), std::move(on_added), profile), | 266 request_->spec(), request_->state(), this, back_navigation_type, |
| 263 &controller_map_), | 267 std::move(on_edited), std::move(on_added), profile), |
| 264 /* animate = */ true); | 268 &controller_map_), |
| 269 /* animate = */ true); |
| 265 if (observer_for_testing_) | 270 if (observer_for_testing_) |
| 266 observer_for_testing_->OnShippingAddressEditorOpened(); | 271 observer_for_testing_->OnShippingAddressEditorOpened(); |
| 267 } | 272 } |
| 268 | 273 |
| 269 void PaymentRequestDialogView::ShowContactInfoEditor( | 274 void PaymentRequestDialogView::ShowContactInfoEditor( |
| 275 BackNavigationType back_navigation_type, |
| 270 autofill::AutofillProfile* profile) { | 276 autofill::AutofillProfile* profile) { |
| 271 view_stack_->Push(CreateViewAndInstallController( | 277 view_stack_->Push(CreateViewAndInstallController( |
| 272 base::MakeUnique<ContactInfoEditorViewController>( | 278 base::MakeUnique<ContactInfoEditorViewController>( |
| 273 request_->spec(), request_->state(), this, profile), | 279 request_->spec(), request_->state(), this, |
| 280 back_navigation_type, profile), |
| 274 &controller_map_), | 281 &controller_map_), |
| 275 /* animate = */ true); | 282 /* animate = */ true); |
| 276 if (observer_for_testing_) | 283 if (observer_for_testing_) |
| 277 observer_for_testing_->OnContactInfoEditorOpened(); | 284 observer_for_testing_->OnContactInfoEditorOpened(); |
| 278 } | 285 } |
| 279 | 286 |
| 280 void PaymentRequestDialogView::EditorViewUpdated() { | 287 void PaymentRequestDialogView::EditorViewUpdated() { |
| 281 if (observer_for_testing_) | 288 if (observer_for_testing_) |
| 282 observer_for_testing_->OnEditorViewUpdated(); | 289 observer_for_testing_->OnEditorViewUpdated(); |
| 283 } | 290 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // When a view that is associated with a controller is removed from this | 354 // When a view that is associated with a controller is removed from this |
| 348 // view's descendants, dispose of the controller. | 355 // view's descendants, dispose of the controller. |
| 349 if (!details.is_add && | 356 if (!details.is_add && |
| 350 controller_map_.find(details.child) != controller_map_.end()) { | 357 controller_map_.find(details.child) != controller_map_.end()) { |
| 351 DCHECK(!details.move_view); | 358 DCHECK(!details.move_view); |
| 352 controller_map_.erase(details.child); | 359 controller_map_.erase(details.child); |
| 353 } | 360 } |
| 354 } | 361 } |
| 355 | 362 |
| 356 } // namespace payments | 363 } // namespace payments |
| OLD | NEW |