| OLD | NEW |
| 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/payment_request_sheet_controller.h" | 5 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 9 #include "chrome/browser/ui/views/payments/payment_request_dialog_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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 bool PaymentRequestSheetController::PerformPrimaryButtonAction() { | 378 bool PaymentRequestSheetController::PerformPrimaryButtonAction() { |
| 379 if (primary_button_ && primary_button_->enabled()) | 379 if (primary_button_ && primary_button_->enabled()) |
| 380 ButtonPressed(primary_button_.get(), DummyEvent()); | 380 ButtonPressed(primary_button_.get(), DummyEvent()); |
| 381 return true; | 381 return true; |
| 382 } | 382 } |
| 383 | 383 |
| 384 void PaymentRequestSheetController::AddPrimaryButton(views::View* container) { | 384 void PaymentRequestSheetController::AddPrimaryButton(views::View* container) { |
| 385 primary_button_ = CreatePrimaryButton(); | 385 primary_button_ = CreatePrimaryButton(); |
| 386 if (primary_button_) { | 386 if (primary_button_) { |
| 387 primary_button_->set_owned_by_client(); | 387 primary_button_->set_owned_by_client(); |
| 388 primary_button_->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
| 388 container->AddChildView(primary_button_.get()); | 389 container->AddChildView(primary_button_.get()); |
| 389 } | 390 } |
| 390 } | 391 } |
| 391 | 392 |
| 392 void PaymentRequestSheetController::AddSecondaryButton(views::View* container) { | 393 void PaymentRequestSheetController::AddSecondaryButton(views::View* container) { |
| 393 secondary_button_ = std::unique_ptr<views::Button>( | 394 secondary_button_ = std::unique_ptr<views::Button>( |
| 394 views::MdTextButton::CreateSecondaryUiButton(this, | 395 views::MdTextButton::CreateSecondaryUiButton(this, |
| 395 GetSecondaryButtonLabel())); | 396 GetSecondaryButtonLabel())); |
| 396 secondary_button_->set_owned_by_client(); | 397 secondary_button_->set_owned_by_client(); |
| 397 secondary_button_->set_tag( | 398 secondary_button_->set_tag( |
| 398 static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); | 399 static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); |
| 399 secondary_button_->set_id(static_cast<int>(DialogViewID::CANCEL_BUTTON)); | 400 secondary_button_->set_id(static_cast<int>(DialogViewID::CANCEL_BUTTON)); |
| 401 secondary_button_->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); |
| 400 container->AddChildView(secondary_button_.get()); | 402 container->AddChildView(secondary_button_.get()); |
| 401 } | 403 } |
| 402 | 404 |
| 403 } // namespace payments | 405 } // namespace payments |
| OLD | NEW |