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/common/extensions/extension_action.h" | 5 #include "chrome/common/extensions/extension_action.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/common/badge_util.h" | 10 #include "chrome/common/badge_util.h" |
11 #include "gfx/canvas_skia.h" | |
12 #include "gfx/rect.h" | |
13 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
14 #include "grit/app_resources.h" | 12 #include "grit/app_resources.h" |
15 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
16 #include "third_party/skia/include/effects/SkGradientShader.h" | 14 #include "third_party/skia/include/effects/SkGradientShader.h" |
17 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/gfx/canvas_skia.h" |
| 17 #include "ui/gfx/rect.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Different platforms need slightly different constants to look good. | 21 // Different platforms need slightly different constants to look good. |
22 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 22 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) |
23 const float kTextSize = 9.0; | 23 const float kTextSize = 9.0; |
24 const int kBottomMargin = 0; | 24 const int kBottomMargin = 0; |
25 const int kPadding = 2; | 25 const int kPadding = 2; |
26 const int kTopTextPadding = 0; | 26 const int kTopTextPadding = 0; |
27 #elif defined(OS_LINUX) && defined(TOOLKIT_VIEWS) | 27 #elif defined(OS_LINUX) && defined(TOOLKIT_VIEWS) |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // text was too large. | 185 // text was too large. |
186 rect.fLeft += kPadding; | 186 rect.fLeft += kPadding; |
187 rect.fRight -= kPadding; | 187 rect.fRight -= kPadding; |
188 canvas->AsCanvasSkia()->clipRect(rect); | 188 canvas->AsCanvasSkia()->clipRect(rect); |
189 canvas->AsCanvasSkia()->drawText(text.c_str(), text.size(), | 189 canvas->AsCanvasSkia()->drawText(text.c_str(), text.size(), |
190 rect.fLeft + (rect.width() - text_width) / 2, | 190 rect.fLeft + (rect.width() - text_width) / 2, |
191 rect.fTop + kTextSize + kTopTextPadding, | 191 rect.fTop + kTextSize + kTopTextPadding, |
192 *text_paint); | 192 *text_paint); |
193 canvas->Restore(); | 193 canvas->Restore(); |
194 } | 194 } |
OLD | NEW |