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

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

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_views_util.h" 5 #include "chrome/browser/ui/views/payments/payment_request_views_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/app/vector_icons/vector_icons.h" 11 #include "chrome/app/vector_icons/vector_icons.h"
12 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h" 12 #include "chrome/browser/ui/views/payments/payment_request_sheet_controller.h"
13 #include "components/autofill/core/browser/autofill_profile.h" 13 #include "components/autofill/core/browser/autofill_profile.h"
14 #include "components/autofill/core/browser/autofill_type.h" 14 #include "components/autofill/core/browser/autofill_type.h"
15 #include "components/autofill/core/browser/field_types.h" 15 #include "components/autofill/core/browser/field_types.h"
16 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
17 #include "ui/compositor/layer_type.h"
17 #include "ui/views/background.h" 18 #include "ui/views/background.h"
18 #include "ui/views/bubble/bubble_frame_view.h" 19 #include "ui/views/bubble/bubble_frame_view.h"
19 #include "ui/views/controls/button/button.h" 20 #include "ui/views/controls/button/button.h"
20 #include "ui/views/controls/button/vector_icon_button.h" 21 #include "ui/views/controls/button/vector_icon_button.h"
21 #include "ui/views/controls/label.h" 22 #include "ui/views/controls/label.h"
22 #include "ui/views/controls/styled_label.h" 23 #include "ui/views/controls/styled_label.h"
23 #include "ui/views/layout/grid_layout.h" 24 #include "ui/views/layout/grid_layout.h"
24 #include "ui/views/view.h" 25 #include "ui/views/view.h"
25 26
26 namespace { 27 namespace {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 84
84 85
85 std::unique_ptr<views::View> CreatePaymentView( 86 std::unique_ptr<views::View> CreatePaymentView(
86 std::unique_ptr<views::View> header_view, 87 std::unique_ptr<views::View> header_view,
87 std::unique_ptr<views::View> content_view) { 88 std::unique_ptr<views::View> content_view) {
88 std::unique_ptr<views::View> view = base::MakeUnique<views::View>(); 89 std::unique_ptr<views::View> view = base::MakeUnique<views::View>();
89 view->set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); 90 view->set_background(views::Background::CreateSolidBackground(SK_ColorWHITE));
90 91
91 // Paint the sheets to layers, otherwise the MD buttons (which do paint to a 92 // Paint the sheets to layers, otherwise the MD buttons (which do paint to a
92 // layer) won't do proper clipping. 93 // layer) won't do proper clipping.
93 view->SetPaintToLayer(true); 94 view->SetPaintToLayer(ui::LAYER_TEXTURED);
94 95
95 views::GridLayout* layout = new views::GridLayout(view.get()); 96 views::GridLayout* layout = new views::GridLayout(view.get());
96 view->SetLayoutManager(layout); 97 view->SetLayoutManager(layout);
97 98
98 constexpr int kTopInsetSize = 9; 99 constexpr int kTopInsetSize = 9;
99 constexpr int kBottomInsetSize = 18; 100 constexpr int kBottomInsetSize = 18;
100 constexpr int kSideInsetSize = 14; 101 constexpr int kSideInsetSize = 14;
101 layout->SetInsets( 102 layout->SetInsets(
102 kTopInsetSize, kSideInsetSize, kBottomInsetSize, kSideInsetSize); 103 kTopInsetSize, kSideInsetSize, kBottomInsetSize, kSideInsetSize);
103 views::ColumnSet* columns = layout->AddColumnSet(0); 104 views::ColumnSet* columns = layout->AddColumnSet(0);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (!phone_value.empty()) 176 if (!phone_value.empty())
176 values.push_back(phone_value); 177 values.push_back(phone_value);
177 if (!email_value.empty()) 178 if (!email_value.empty())
178 values.push_back(email_value); 179 values.push_back(email_value);
179 180
180 return base::MakeUnique<views::StyledLabel>( 181 return base::MakeUnique<views::StyledLabel>(
181 base::JoinString(values, base::ASCIIToUTF16("\n")), nullptr); 182 base::JoinString(values, base::ASCIIToUTF16("\n")), nullptr);
182 } 183 }
183 184
184 } // namespace payments 185 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698