| 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 "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const float kTextSize = 8.0; | 30 const float kTextSize = 8.0; |
| 31 const int kBottomMargin = 5; | 31 const int kBottomMargin = 5; |
| 32 const int kPadding = 2; | 32 const int kPadding = 2; |
| 33 const int kTopTextPadding = 1; | 33 const int kTopTextPadding = 1; |
| 34 #elif defined(OS_MACOSX) | 34 #elif defined(OS_MACOSX) |
| 35 const float kTextSize = 9.0; | 35 const float kTextSize = 9.0; |
| 36 const int kBottomMargin = 5; | 36 const int kBottomMargin = 5; |
| 37 const int kPadding = 2; | 37 const int kPadding = 2; |
| 38 const int kTopTextPadding = 0; | 38 const int kTopTextPadding = 0; |
| 39 #else | 39 #else |
| 40 const float kTextSize = 7.5; | 40 const float kTextSize = 10; |
| 41 const int kBottomMargin = 5; | 41 const int kBottomMargin = 5; |
| 42 const int kPadding = 2; | 42 const int kPadding = 2; |
| 43 // The padding between the top of the badge and the top of the text. | 43 // The padding between the top of the badge and the top of the text. |
| 44 const int kTopTextPadding = 1; | 44 const int kTopTextPadding = -1; |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 const int kBadgeHeight = 11; | 47 const int kBadgeHeight = 11; |
| 48 const int kMaxTextWidth = 23; | 48 const int kMaxTextWidth = 23; |
| 49 // The minimum width for center-aligning the badge. | 49 // The minimum width for center-aligning the badge. |
| 50 const int kCenterAlignThreshold = 20; | 50 const int kCenterAlignThreshold = 20; |
| 51 | 51 |
| 52 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
| 53 const char kPreferredTypeface[] = "Helvetica Bold"; | 53 const char kPreferredTypeface[] = "Helvetica Bold"; |
| 54 #else | 54 #else |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // text was too large. | 224 // text was too large. |
| 225 rect.fLeft += kPadding; | 225 rect.fLeft += kPadding; |
| 226 rect.fRight -= kPadding; | 226 rect.fRight -= kPadding; |
| 227 canvas->AsCanvasSkia()->clipRect(rect); | 227 canvas->AsCanvasSkia()->clipRect(rect); |
| 228 canvas->AsCanvasSkia()->drawText(text.c_str(), text.size(), | 228 canvas->AsCanvasSkia()->drawText(text.c_str(), text.size(), |
| 229 rect.fLeft + (rect.width() - text_width) / 2, | 229 rect.fLeft + (rect.width() - text_width) / 2, |
| 230 rect.fTop + kTextSize + kTopTextPadding, | 230 rect.fTop + kTextSize + kTopTextPadding, |
| 231 *text_paint); | 231 *text_paint); |
| 232 canvas->Restore(); | 232 canvas->Restore(); |
| 233 } | 233 } |
| OLD | NEW |