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

Side by Side Diff: chrome/browser/ui/views/payments/error_message_view_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/payments/error_message_view_controller.h"
6
7 #include <memory>
8
9 #include "base/memory/ptr_util.h"
10 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
11 #include "components/strings/grit/components_strings.h"
12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/native_theme/native_theme.h"
14 #include "ui/views/controls/label.h"
15 #include "ui/views/layout/box_layout.h"
16
17 namespace payments {
18
19 ErrorMessageViewController::ErrorMessageViewController(
20 PaymentRequestSpec* spec,
21 PaymentRequestState* state,
22 PaymentRequestDialogView* dialog)
23 : PaymentRequestSheetController(spec, state, dialog) {}
24
25 ErrorMessageViewController::~ErrorMessageViewController() {}
26
27 base::string16 ErrorMessageViewController::GetSecondaryButtonLabel() {
28 return l10n_util::GetStringUTF16(IDS_CLOSE);
29 }
30
31 bool ErrorMessageViewController::ShouldShowHeaderBackArrow() {
32 return false;
33 }
34
35 base::string16 ErrorMessageViewController::GetSheetTitle() {
36 return l10n_util::GetStringUTF16(IDS_PAYMENTS_ERROR_MESSAGE_DIALOG_TITLE);
37 }
38
39 void ErrorMessageViewController::FillContentView(views::View* content_view) {
40 views::BoxLayout* layout = new views::BoxLayout(
41 views::BoxLayout::kVertical, kPaymentRequestRowHorizontalInsets, 0, 0);
42 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
43 layout->set_cross_axis_alignment(
44 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START);
45 content_view->SetLayoutManager(layout);
46
47 std::unique_ptr<views::Label> label = base::MakeUnique<views::Label>(
48 l10n_util::GetStringUTF16(IDS_PAYMENTS_ERROR_MESSAGE));
49 label->SetEnabledColor(label->GetNativeTheme()->GetSystemColor(
50 ui::NativeTheme::kColorId_AlertSeverityHigh));
51 label->SetMultiLine(true);
52
53 content_view->AddChildView(label.release());
54 }
55
56 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698