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

Side by Side Diff: chrome/browser/views/theme_install_bubble_view.cc

Issue 2811032: Revert 50784 - Canvas refactoring part 3.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.cc ('k') | chrome/common/extensions/extension_action.cc » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/theme_install_bubble_view.h" 5 #include "chrome/browser/views/theme_install_bubble_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "chrome/browser/tab_contents/tab_contents.h" 9 #include "chrome/browser/tab_contents/tab_contents.h"
10 #include "gfx/canvas_skia.h"
11 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
12 #include "views/widget/widget.h" 11 #include "views/widget/widget.h"
13 12
14 namespace { 13 namespace {
15 14
16 // The roundedness of the edges of our bubble. 15 // The roundedness of the edges of our bubble.
17 static const int kBubbleCornerRadius = 4; 16 static const int kBubbleCornerRadius = 4;
18 17
19 // Padding around text in popup box. 18 // Padding around text in popup box.
20 static const int kTextHorizPadding = 90; 19 static const int kTextHorizPadding = 90;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 paint.setStyle(SkPaint::kFill_Style); 118 paint.setStyle(SkPaint::kFill_Style);
120 paint.setFlags(SkPaint::kAntiAlias_Flag); 119 paint.setFlags(SkPaint::kAntiAlias_Flag);
121 paint.setColor(SK_ColorBLACK); 120 paint.setColor(SK_ColorBLACK);
122 121
123 SkRect rect; 122 SkRect rect;
124 rect.set(0, 0, 123 rect.set(0, 0,
125 SkIntToScalar(width()), 124 SkIntToScalar(width()),
126 SkIntToScalar(height())); 125 SkIntToScalar(height()));
127 SkPath path; 126 SkPath path;
128 path.addRoundRect(rect, rad, SkPath::kCW_Direction); 127 path.addRoundRect(rect, rad, SkPath::kCW_Direction);
129 canvas->AsCanvasSkia()->drawPath(path, paint); 128 canvas->drawPath(path, paint);
130 129
131 int text_width = views::Label::font().GetStringWidth(text_); 130 int text_width = views::Label::font().GetStringWidth(text_);
132 gfx::Rect body_bounds(kTextHorizPadding / 2, 0, text_width, height()); 131 gfx::Rect body_bounds(kTextHorizPadding / 2, 0, text_width, height());
133 body_bounds.set_x(MirroredLeftPointForRect(body_bounds)); 132 body_bounds.set_x(MirroredLeftPointForRect(body_bounds));
134 133
135 SkColor text_color = SK_ColorWHITE; 134 SkColor text_color = SK_ColorWHITE;
136 canvas->DrawStringInt(text_, views::Label::font(), text_color, 135 canvas->DrawStringInt(text_, views::Label::font(), text_color,
137 body_bounds.x(), body_bounds.y(), body_bounds.width(), 136 body_bounds.x(), body_bounds.y(), body_bounds.width(),
138 body_bounds.height()); 137 body_bounds.height());
139 } 138 }
(...skipping 16 matching lines...) Expand all
156 Close(); 155 Close();
157 } 156 }
158 157
159 // static 158 // static
160 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { 159 void ThemeInstallBubbleView::Show(TabContents* tab_contents) {
161 ++num_loads_extant_; 160 ++num_loads_extant_;
162 if (num_loads_extant_ < 2) 161 if (num_loads_extant_ < 2)
163 new ThemeInstallBubbleView(tab_contents); 162 new ThemeInstallBubbleView(tab_contents);
164 } 163 }
165 164
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.cc ('k') | chrome/common/extensions/extension_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698