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

Side by Side Diff: ui/views/corewm/tooltip_aura.cc

Issue 2637383003: Change Painter factory functions to unique_ptr (Closed)
Patch Set: msw review 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
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/painter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/views/corewm/tooltip_aura.h" 5 #include "ui/views/corewm/tooltip_aura.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void SetForegroundColor(SkColor color) { 119 void SetForegroundColor(SkColor color) {
120 render_text_->SetColor(color); 120 render_text_->SetColor(color);
121 } 121 }
122 122
123 void SetBackgroundColor(SkColor background_color) { 123 void SetBackgroundColor(SkColor background_color) {
124 // Corner radius of tooltip background. 124 // Corner radius of tooltip background.
125 const float kTooltipCornerRadius = 2.f; 125 const float kTooltipCornerRadius = 2.f;
126 views::Background* background = 126 views::Background* background =
127 CanUseTranslucentTooltipWidget() 127 CanUseTranslucentTooltipWidget()
128 ? views::Background::CreateBackgroundPainter( 128 ? views::Background::CreateBackgroundPainter(
129 true, views::Painter::CreateSolidRoundRectPainter( 129 views::Painter::CreateSolidRoundRectPainter(
130 background_color, kTooltipCornerRadius)) 130 background_color, kTooltipCornerRadius))
131 : views::Background::CreateSolidBackground(background_color); 131 : views::Background::CreateSolidBackground(background_color);
132 set_background(background); 132 set_background(background);
133 // Force the text color to be readable when |background_color| is not 133 // Force the text color to be readable when |background_color| is not
134 // opaque. 134 // opaque.
135 render_text_->set_subpixel_rendering_suppressed( 135 render_text_->set_subpixel_rendering_suppressed(
136 SkColorGetA(background_color) != 0xFF); 136 SkColorGetA(background_color) != 0xFF);
137 } 137 }
138 138
139 void SetMaxWidth(int width) { 139 void SetMaxWidth(int width) {
140 max_width_ = width; 140 max_width_ = width;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 void TooltipAura::OnWidgetDestroying(views::Widget* widget) { 247 void TooltipAura::OnWidgetDestroying(views::Widget* widget) {
248 DCHECK_EQ(widget_, widget); 248 DCHECK_EQ(widget_, widget);
249 widget_ = NULL; 249 widget_ = NULL;
250 tooltip_window_ = NULL; 250 tooltip_window_ = NULL;
251 } 251 }
252 252
253 } // namespace corewm 253 } // namespace corewm
254 } // namespace views 254 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/painter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698