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

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

Issue 2859193004: Remove GridLayout::SetInsets in favor of an empty border on the host. (Closed)
Patch Set: missed a merge problem Created 3 years, 7 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_views_util.h" 8 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
9 #include "components/payments/content/payment_request.h" 9 #include "components/payments/content/payment_request.h"
10 #include "components/strings/grit/components_strings.h" 10 #include "components/strings/grit/components_strings.h"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/views/background.h" 12 #include "ui/views/background.h"
13 #include "ui/views/border.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/focus/focus_search.h" 16 #include "ui/views/focus/focus_search.h"
16 #include "ui/views/layout/box_layout.h" 17 #include "ui/views/layout/box_layout.h"
17 #include "ui/views/layout/fill_layout.h" 18 #include "ui/views/layout/fill_layout.h"
18 #include "ui/views/layout/grid_layout.h" 19 #include "ui/views/layout/grid_layout.h"
19 20
20 namespace payments { 21 namespace payments {
21 22
22 namespace { 23 namespace {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 break; 223 break;
223 case PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX: 224 case PaymentRequestCommonTags::PAYMENT_REQUEST_COMMON_TAG_MAX:
224 NOTREACHED(); 225 NOTREACHED();
225 break; 226 break;
226 } 227 }
227 } 228 }
228 229
229 std::unique_ptr<views::View> PaymentRequestSheetController::CreateFooterView() { 230 std::unique_ptr<views::View> PaymentRequestSheetController::CreateFooterView() {
230 std::unique_ptr<views::View> container = base::MakeUnique<views::View>(); 231 std::unique_ptr<views::View> container = base::MakeUnique<views::View>();
231 232
233 // The distance between the elements and the dialog borders.
234 constexpr int kInset = 16;
235 container->SetBorder(
236 views::CreateEmptyBorder(kInset, kInset, kInset, kInset));
237
232 views::GridLayout* layout = new views::GridLayout(container.get()); 238 views::GridLayout* layout = new views::GridLayout(container.get());
233 container->SetLayoutManager(layout); 239 container->SetLayoutManager(layout);
234 240
235 views::ColumnSet* columns = layout->AddColumnSet(0); 241 views::ColumnSet* columns = layout->AddColumnSet(0);
236 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 242 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
237 0, views::GridLayout::USE_PREF, 0, 0); 243 0, views::GridLayout::USE_PREF, 0, 0);
238 columns->AddPaddingColumn(1, 0); 244 columns->AddPaddingColumn(1, 0);
239 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER, 245 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::CENTER,
240 0, views::GridLayout::USE_PREF, 0, 0); 246 0, views::GridLayout::USE_PREF, 0, 0);
241 247
242 // The horizontal distance between the right/left edges of the dialog and the
243 // elements.
244 constexpr int kFooterHorizontalInset = 16;
245 // The vertical distance between footer elements and the top/bottom border
246 // (the bottom border is the edge of the dialog).
247 constexpr int kFooterVerticalInset = 16;
248 layout->SetInsets(kFooterVerticalInset, kFooterHorizontalInset,
249 kFooterVerticalInset, kFooterHorizontalInset);
250 layout->StartRow(0, 0); 248 layout->StartRow(0, 0);
251 std::unique_ptr<views::View> extra_view = CreateExtraFooterView(); 249 std::unique_ptr<views::View> extra_view = CreateExtraFooterView();
252 if (extra_view) 250 if (extra_view)
253 layout->AddView(extra_view.release()); 251 layout->AddView(extra_view.release());
254 else 252 else
255 layout->SkipColumns(1); 253 layout->SkipColumns(1);
256 254
257 std::unique_ptr<views::View> trailing_buttons_container = 255 std::unique_ptr<views::View> trailing_buttons_container =
258 base::MakeUnique<views::View>(); 256 base::MakeUnique<views::View>();
259 257
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 293
296 bool PaymentRequestSheetController::PerformPrimaryButtonAction() { 294 bool PaymentRequestSheetController::PerformPrimaryButtonAction() {
297 if (primary_button_ && primary_button_->enabled()) { 295 if (primary_button_ && primary_button_->enabled()) {
298 ButtonPressed(primary_button_.get(), DummyEvent()); 296 ButtonPressed(primary_button_.get(), DummyEvent());
299 return true; 297 return true;
300 } 298 }
301 return false; 299 return false;
302 } 300 }
303 301
304 } // namespace payments 302 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698