| 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/editor_view_controller.h" | 5 #include "chrome/browser/ui/views/payments/editor_view_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 13 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
| 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" | 14 #include "chrome/browser/ui/views/payments/payment_request_dialog_view_ids.h" |
| 15 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" | 15 #include "chrome/browser/ui/views/payments/payment_request_views_util.h" |
| 16 #include "chrome/browser/ui/views/payments/validating_combobox.h" | 16 #include "chrome/browser/ui/views/payments/validating_combobox.h" |
| 17 #include "chrome/browser/ui/views/payments/validating_textfield.h" | 17 #include "chrome/browser/ui/views/payments/validating_textfield.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "components/payments/content/payment_request.h" | |
| 20 #include "components/strings/grit/components_strings.h" | 19 #include "components/strings/grit/components_strings.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 22 #include "ui/native_theme/native_theme.h" | 21 #include "ui/native_theme/native_theme.h" |
| 23 #include "ui/views/border.h" | 22 #include "ui/views/border.h" |
| 24 #include "ui/views/controls/button/label_button.h" | 23 #include "ui/views/controls/button/label_button.h" |
| 25 #include "ui/views/controls/button/md_text_button.h" | 24 #include "ui/views/controls/button/md_text_button.h" |
| 26 #include "ui/views/controls/label.h" | 25 #include "ui/views/controls/label.h" |
| 27 #include "ui/views/controls/styled_label.h" | 26 #include "ui/views/controls/styled_label.h" |
| 28 #include "ui/views/controls/textfield/textfield.h" | 27 #include "ui/views/controls/textfield/textfield.h" |
| 29 #include "ui/views/layout/box_layout.h" | 28 #include "ui/views/layout/box_layout.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 // The tag for the button that saves the model being edited. Starts at | 39 // The tag for the button that saves the model being edited. Starts at |
| 41 // |kFirstTagValue| not to conflict with tags common to all views. | 40 // |kFirstTagValue| not to conflict with tags common to all views. |
| 42 SAVE_BUTTON = kFirstTagValue, | 41 SAVE_BUTTON = kFirstTagValue, |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 constexpr int kNumCharactersInShortField = 8; | 44 constexpr int kNumCharactersInShortField = 8; |
| 46 constexpr int kNumCharactersInLongField = 20; | 45 constexpr int kNumCharactersInLongField = 20; |
| 47 | 46 |
| 48 } // namespace | 47 } // namespace |
| 49 | 48 |
| 50 EditorViewController::EditorViewController(PaymentRequest* request, | 49 EditorViewController::EditorViewController(PaymentRequestSpec* spec, |
| 50 PaymentRequestState* state, |
| 51 PaymentRequestDialogView* dialog) | 51 PaymentRequestDialogView* dialog) |
| 52 : PaymentRequestSheetController(request, dialog) {} | 52 : PaymentRequestSheetController(spec, state, dialog) {} |
| 53 | 53 |
| 54 EditorViewController::~EditorViewController() {} | 54 EditorViewController::~EditorViewController() {} |
| 55 | 55 |
| 56 std::unique_ptr<views::View> EditorViewController::CreateView() { | 56 std::unique_ptr<views::View> EditorViewController::CreateView() { |
| 57 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); | 57 std::unique_ptr<views::View> content_view = base::MakeUnique<views::View>(); |
| 58 | 58 |
| 59 views::BoxLayout* layout = | 59 views::BoxLayout* layout = |
| 60 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); | 60 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); |
| 61 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); | 61 layout->set_main_axis_alignment(views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); |
| 62 layout->set_cross_axis_alignment( | 62 layout->set_cross_axis_alignment( |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 error_label->SetFontList( | 234 error_label->SetFontList( |
| 235 error_label->GetDefaultFontList().DeriveWithSizeDelta(-1)); | 235 error_label->GetDefaultFontList().DeriveWithSizeDelta(-1)); |
| 236 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( | 236 error_label->SetEnabledColor(error_label->GetNativeTheme()->GetSystemColor( |
| 237 ui::NativeTheme::kColorId_AlertSeverityHigh)); | 237 ui::NativeTheme::kColorId_AlertSeverityHigh)); |
| 238 error_labels_[field] = error_label.get(); | 238 error_labels_[field] = error_label.get(); |
| 239 | 239 |
| 240 layout->AddView(error_label.release()); | 240 layout->AddView(error_label.release()); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace payments | 243 } // namespace payments |
| OLD | NEW |