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

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

Issue 2768093006: [Payments] Desktop: Error message in the dialog. (Closed)
Patch Set: Test 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/payment_request_sheet_controller.h" 5 #include "chrome/browser/ui/views/payments/payment_request_sheet_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_views_util.h" 9 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
9 #include "components/payments/content/payment_request.h" 10 #include "components/payments/content/payment_request.h"
10 #include "components/strings/grit/components_strings.h" 11 #include "components/strings/grit/components_strings.h"
11 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/views/background.h" 13 #include "ui/views/background.h"
13 #include "ui/views/controls/button/md_text_button.h" 14 #include "ui/views/controls/button/md_text_button.h"
14 #include "ui/views/controls/scroll_view.h" 15 #include "ui/views/controls/scroll_view.h"
15 #include "ui/views/layout/box_layout.h" 16 #include "ui/views/layout/box_layout.h"
16 #include "ui/views/layout/fill_layout.h" 17 #include "ui/views/layout/fill_layout.h"
17 #include "ui/views/layout/grid_layout.h" 18 #include "ui/views/layout/grid_layout.h"
(...skipping 21 matching lines...) Expand all
39 content_view_->RemoveAllChildViews(true); 40 content_view_->RemoveAllChildViews(true);
40 FillContentView(content_view_); 41 FillContentView(content_view_);
41 content_view_->Layout(); 42 content_view_->Layout();
42 } 43 }
43 44
44 std::unique_ptr<views::Button> 45 std::unique_ptr<views::Button>
45 PaymentRequestSheetController::CreatePrimaryButton() { 46 PaymentRequestSheetController::CreatePrimaryButton() {
46 return nullptr; 47 return nullptr;
47 } 48 }
48 49
50 base::string16 PaymentRequestSheetController::GetSecondaryButtonLabel() {
51 return l10n_util::GetStringUTF16(IDS_CANCEL);
52 }
53
49 bool PaymentRequestSheetController::ShouldShowHeaderBackArrow() { 54 bool PaymentRequestSheetController::ShouldShowHeaderBackArrow() {
50 return true; 55 return true;
51 } 56 }
52 57
53 std::unique_ptr<views::View> 58 std::unique_ptr<views::View>
54 PaymentRequestSheetController::CreateExtraFooterView() { 59 PaymentRequestSheetController::CreateExtraFooterView() {
55 return nullptr; 60 return nullptr;
56 } 61 }
57 62
58 void PaymentRequestSheetController::ButtonPressed( 63 void PaymentRequestSheetController::ButtonPressed(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 base::MakeUnique<views::View>(); 152 base::MakeUnique<views::View>();
148 153
149 trailing_buttons_container->SetLayoutManager(new views::BoxLayout( 154 trailing_buttons_container->SetLayoutManager(new views::BoxLayout(
150 views::BoxLayout::kHorizontal, 0, 0, kPaymentRequestButtonSpacing)); 155 views::BoxLayout::kHorizontal, 0, 0, kPaymentRequestButtonSpacing));
151 156
152 std::unique_ptr<views::Button> primary_button = CreatePrimaryButton(); 157 std::unique_ptr<views::Button> primary_button = CreatePrimaryButton();
153 if (primary_button) 158 if (primary_button)
154 trailing_buttons_container->AddChildView(primary_button.release()); 159 trailing_buttons_container->AddChildView(primary_button.release());
155 160
156 views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton( 161 views::LabelButton* button = views::MdTextButton::CreateSecondaryUiButton(
157 this, l10n_util::GetStringUTF16(IDS_CANCEL)); 162 this, GetSecondaryButtonLabel());
158 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG)); 163 button->set_tag(static_cast<int>(PaymentRequestCommonTags::CLOSE_BUTTON_TAG));
164 button->set_id(static_cast<int>(DialogViewID::CANCEL_BUTTON));
159 trailing_buttons_container->AddChildView(button); 165 trailing_buttons_container->AddChildView(button);
160 166
161 layout->AddView(trailing_buttons_container.release()); 167 layout->AddView(trailing_buttons_container.release());
162 168
163 return container; 169 return container;
164 } 170 }
165 171
166 } // namespace payments 172 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698