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

Side by Side Diff: chrome/browser/ui/views/subtle_notification_view.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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/subtle_notification_view.h" 5 #include "chrome/browser/ui/views/subtle_notification_view.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 views::View* key = new views::View; 124 views::View* key = new views::View;
125 views::BoxLayout* key_name_layout = new views::BoxLayout( 125 views::BoxLayout* key_name_layout = new views::BoxLayout(
126 views::BoxLayout::kHorizontal, kKeyNamePaddingPx, 0, 0); 126 views::BoxLayout::kHorizontal, kKeyNamePaddingPx, 0, 0);
127 key_name_layout->set_minimum_cross_axis_size( 127 key_name_layout->set_minimum_cross_axis_size(
128 label->GetPreferredSize().height() + kKeyNamePaddingPx * 2); 128 label->GetPreferredSize().height() + kKeyNamePaddingPx * 2);
129 key->SetLayoutManager(key_name_layout); 129 key->SetLayoutManager(key_name_layout);
130 key->AddChildView(label); 130 key->AddChildView(label);
131 // The key name has a border around it. 131 // The key name has a border around it.
132 std::unique_ptr<views::Border> border(views::Border::CreateRoundedRectBorder( 132 std::unique_ptr<views::Border> border(views::CreateRoundedRectBorder(
133 kKeyNameBorderPx, kKeyNameCornerRadius, foreground_color_)); 133 kKeyNameBorderPx, kKeyNameCornerRadius, foreground_color_));
134 key->SetBorder(std::move(border)); 134 key->SetBorder(std::move(border));
135 AddChildView(key); 135 AddChildView(key);
136 } 136 }
137 137
138 SubtleNotificationView::SubtleNotificationView( 138 SubtleNotificationView::SubtleNotificationView(
139 views::LinkListener* link_listener) 139 views::LinkListener* link_listener)
140 : instruction_view_(nullptr), link_(nullptr) { 140 : instruction_view_(nullptr), link_(nullptr) {
141 const SkColor kForegroundColor = SK_ColorWHITE; 141 const SkColor kForegroundColor = SK_ColorWHITE;
142 142
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // We set layout manager to nullptr to prevent the widget from sizing its 201 // We set layout manager to nullptr to prevent the widget from sizing its
202 // contents to the same size as itself. This prevents the widget contents from 202 // contents to the same size as itself. This prevents the widget contents from
203 // shrinking while we animate the height of the popup to give the impression 203 // shrinking while we animate the height of the popup to give the impression
204 // that it is sliding off the top of the screen. 204 // that it is sliding off the top of the screen.
205 // TODO(mgiuca): This probably isn't necessary now that there is no slide 205 // TODO(mgiuca): This probably isn't necessary now that there is no slide
206 // animation. Remove it. 206 // animation. Remove it.
207 popup->GetRootView()->SetLayoutManager(nullptr); 207 popup->GetRootView()->SetLayoutManager(nullptr);
208 208
209 return popup; 209 return popup;
210 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698