| OLD | NEW |
| 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" |
| 10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 11 #include "views/widget/widget.h" | 12 #include "views/widget/widget.h" |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 // The roundedness of the edges of our bubble. | 16 // The roundedness of the edges of our bubble. |
| 16 static const int kBubbleCornerRadius = 4; | 17 static const int kBubbleCornerRadius = 4; |
| 17 | 18 |
| 18 // Padding around text in popup box. | 19 // Padding around text in popup box. |
| 19 static const int kTextHorizPadding = 90; | 20 static const int kTextHorizPadding = 90; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 paint.setStyle(SkPaint::kFill_Style); | 119 paint.setStyle(SkPaint::kFill_Style); |
| 119 paint.setFlags(SkPaint::kAntiAlias_Flag); | 120 paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 120 paint.setColor(SK_ColorBLACK); | 121 paint.setColor(SK_ColorBLACK); |
| 121 | 122 |
| 122 SkRect rect; | 123 SkRect rect; |
| 123 rect.set(0, 0, | 124 rect.set(0, 0, |
| 124 SkIntToScalar(width()), | 125 SkIntToScalar(width()), |
| 125 SkIntToScalar(height())); | 126 SkIntToScalar(height())); |
| 126 SkPath path; | 127 SkPath path; |
| 127 path.addRoundRect(rect, rad, SkPath::kCW_Direction); | 128 path.addRoundRect(rect, rad, SkPath::kCW_Direction); |
| 128 canvas->drawPath(path, paint); | 129 canvas->AsCanvasSkia()->drawPath(path, paint); |
| 129 | 130 |
| 130 int text_width = views::Label::font().GetStringWidth(text_); | 131 int text_width = views::Label::font().GetStringWidth(text_); |
| 131 gfx::Rect body_bounds(kTextHorizPadding / 2, 0, text_width, height()); | 132 gfx::Rect body_bounds(kTextHorizPadding / 2, 0, text_width, height()); |
| 132 body_bounds.set_x(MirroredLeftPointForRect(body_bounds)); | 133 body_bounds.set_x(MirroredLeftPointForRect(body_bounds)); |
| 133 | 134 |
| 134 SkColor text_color = SK_ColorWHITE; | 135 SkColor text_color = SK_ColorWHITE; |
| 135 canvas->DrawStringInt(text_, views::Label::font(), text_color, | 136 canvas->DrawStringInt(text_, views::Label::font(), text_color, |
| 136 body_bounds.x(), body_bounds.y(), body_bounds.width(), | 137 body_bounds.x(), body_bounds.y(), body_bounds.width(), |
| 137 body_bounds.height()); | 138 body_bounds.height()); |
| 138 } | 139 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 155 Close(); | 156 Close(); |
| 156 } | 157 } |
| 157 | 158 |
| 158 // static | 159 // static |
| 159 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { | 160 void ThemeInstallBubbleView::Show(TabContents* tab_contents) { |
| 160 ++num_loads_extant_; | 161 ++num_loads_extant_; |
| 161 if (num_loads_extant_ < 2) | 162 if (num_loads_extant_ < 2) |
| 162 new ThemeInstallBubbleView(tab_contents); | 163 new ThemeInstallBubbleView(tab_contents); |
| 163 } | 164 } |
| 164 | 165 |
| OLD | NEW |