OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/autofill/save_card_bubble_views.h" | 5 #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ui/views/layout/box_layout.h" | 25 #include "ui/views/layout/box_layout.h" |
26 #include "ui/views/layout/layout_constants.h" | 26 #include "ui/views/layout/layout_constants.h" |
27 | 27 |
28 namespace autofill { | 28 namespace autofill { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Fixed width of the bubble. | 32 // Fixed width of the bubble. |
33 const int kBubbleWidth = 395; | 33 const int kBubbleWidth = 395; |
34 | 34 |
35 scoped_ptr<views::StyledLabel> CreateLegalMessageLineLabel( | 35 std::unique_ptr<views::StyledLabel> CreateLegalMessageLineLabel( |
36 const LegalMessageLine& line, | 36 const LegalMessageLine& line, |
37 views::StyledLabelListener* listener) { | 37 views::StyledLabelListener* listener) { |
38 scoped_ptr<views::StyledLabel> label( | 38 std::unique_ptr<views::StyledLabel> label( |
39 new views::StyledLabel(line.text(), listener)); | 39 new views::StyledLabel(line.text(), listener)); |
40 for (const LegalMessageLine::Link& link : line.links()) { | 40 for (const LegalMessageLine::Link& link : line.links()) { |
41 label->AddStyleRange(link.range, | 41 label->AddStyleRange(link.range, |
42 views::StyledLabel::RangeStyleInfo::CreateForLink()); | 42 views::StyledLabel::RangeStyleInfo::CreateForLink()); |
43 } | 43 } |
44 return label; | 44 return label; |
45 } | 45 } |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 controller_->OnLegalMessageLinkClicked(link.url); | 160 controller_->OnLegalMessageLinkClicked(link.url); |
161 return; | 161 return; |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 // |range| was not found. | 165 // |range| was not found. |
166 NOTREACHED(); | 166 NOTREACHED(); |
167 } | 167 } |
168 | 168 |
169 // Create view containing everything except for the footnote. | 169 // Create view containing everything except for the footnote. |
170 scoped_ptr<views::View> SaveCardBubbleViews::CreateMainContentView() { | 170 std::unique_ptr<views::View> SaveCardBubbleViews::CreateMainContentView() { |
171 scoped_ptr<View> view(new View()); | 171 std::unique_ptr<View> view(new View()); |
172 view->SetLayoutManager( | 172 view->SetLayoutManager( |
173 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, | 173 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, |
174 views::kUnrelatedControlVerticalSpacing)); | 174 views::kUnrelatedControlVerticalSpacing)); |
175 | 175 |
176 // Add the card type icon, last four digits and expiration date. | 176 // Add the card type icon, last four digits and expiration date. |
177 views::View* description_view = new views::View(); | 177 views::View* description_view = new views::View(); |
178 description_view->SetLayoutManager(new views::BoxLayout( | 178 description_view->SetLayoutManager(new views::BoxLayout( |
179 views::BoxLayout::kHorizontal, 0, 0, views::kRelatedButtonHSpacing)); | 179 views::BoxLayout::kHorizontal, 0, 0, views::kRelatedButtonHSpacing)); |
180 view->AddChildView(description_view); | 180 view->AddChildView(description_view); |
181 | 181 |
(...skipping 24 matching lines...) Expand all Loading... |
206 | 206 |
207 return view; | 207 return view; |
208 } | 208 } |
209 | 209 |
210 void SaveCardBubbleViews::Init() { | 210 void SaveCardBubbleViews::Init() { |
211 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 211 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
212 AddChildView(CreateMainContentView().release()); | 212 AddChildView(CreateMainContentView().release()); |
213 } | 213 } |
214 | 214 |
215 } // namespace autofill | 215 } // namespace autofill |
OLD | NEW |