| 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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 if (typeface) { | 69 if (typeface) { |
| 70 text_paint->setFakeBoldText(true); | 70 text_paint->setFakeBoldText(true); |
| 71 } else { | 71 } else { |
| 72 // Fall back to the system font. We don't bold it because we aren't sure | 72 // Fall back to the system font. We don't bold it because we aren't sure |
| 73 // how it will look. | 73 // how it will look. |
| 74 // For the most part this code path will only be hit on Linux systems | 74 // For the most part this code path will only be hit on Linux systems |
| 75 // that don't have Arial. | 75 // that don't have Arial. |
| 76 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 76 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 77 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); | 77 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); |
| 78 typeface = SkTypeface::CreateFromName( | 78 typeface = SkTypeface::CreateFromName( |
| 79 WideToUTF8(base_font.FontName()).c_str(), SkTypeface::kNormal); | 79 WideToUTF8(base_font.GetFontName()).c_str(), SkTypeface::kNormal); |
| 80 } | 80 } |
| 81 | 81 |
| 82 text_paint->setTypeface(typeface); | 82 text_paint->setTypeface(typeface); |
| 83 // |text_paint| adds its own ref. Release the ref from CreateFontName. | 83 // |text_paint| adds its own ref. Release the ref from CreateFontName. |
| 84 typeface->unref(); | 84 typeface->unref(); |
| 85 } | 85 } |
| 86 return text_paint; | 86 return text_paint; |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace | 89 } // namespace |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // text was too large. | 183 // text was too large. |
| 184 rect.fLeft += kPadding; | 184 rect.fLeft += kPadding; |
| 185 rect.fRight -= kPadding; | 185 rect.fRight -= kPadding; |
| 186 canvas->AsCanvasSkia()->clipRect(rect); | 186 canvas->AsCanvasSkia()->clipRect(rect); |
| 187 canvas->AsCanvasSkia()->drawText(text.c_str(), text.size(), | 187 canvas->AsCanvasSkia()->drawText(text.c_str(), text.size(), |
| 188 rect.fLeft + (rect.width() - text_width) / 2, | 188 rect.fLeft + (rect.width() - text_width) / 2, |
| 189 rect.fTop + kTextSize + kTopTextPadding, | 189 rect.fTop + kTextSize + kTopTextPadding, |
| 190 *text_paint); | 190 *text_paint); |
| 191 canvas->Restore(); | 191 canvas->Restore(); |
| 192 } | 192 } |
| OLD | NEW |