OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/ntp/ntp_login_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 namespace { | 54 namespace { |
55 | 55 |
56 SkBitmap GetGAIAPictureForNTP(const gfx::Image& image) { | 56 SkBitmap GetGAIAPictureForNTP(const gfx::Image& image) { |
57 // This value must match the width and height value of login-status-icon | 57 // This value must match the width and height value of login-status-icon |
58 // in new_tab.css. | 58 // in new_tab.css. |
59 const int kLength = 27; | 59 const int kLength = 27; |
60 SkBitmap bmp = skia::ImageOperations::Resize(*image.ToSkBitmap(), | 60 SkBitmap bmp = skia::ImageOperations::Resize(*image.ToSkBitmap(), |
61 skia::ImageOperations::RESIZE_BEST, kLength, kLength); | 61 skia::ImageOperations::RESIZE_BEST, kLength, kLength); |
62 | 62 |
63 gfx::Canvas canvas(gfx::Size(kLength, kLength), false); | 63 gfx::Canvas canvas(gfx::Size(kLength, kLength), ui::SCALE_FACTOR_100P, |
| 64 false); |
64 canvas.DrawImageInt(bmp, 0, 0); | 65 canvas.DrawImageInt(bmp, 0, 0); |
65 | 66 |
66 // Draw a gray border on the inside of the icon. | 67 // Draw a gray border on the inside of the icon. |
67 SkColor color = SkColorSetARGB(83, 0, 0, 0); | 68 SkColor color = SkColorSetARGB(83, 0, 0, 0); |
68 canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color); | 69 canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color); |
69 | 70 |
70 return canvas.ExtractBitmap(); | 71 return canvas.ExtractImageRep().sk_bitmap(); |
71 } | 72 } |
72 | 73 |
73 // Puts the |content| into a span with the given CSS class. | 74 // Puts the |content| into a span with the given CSS class. |
74 string16 CreateSpanWithClass(const string16& content, | 75 string16 CreateSpanWithClass(const string16& content, |
75 const std::string& css_class) { | 76 const std::string& css_class) { |
76 return ASCIIToUTF16("<span class='" + css_class + "'>") + | 77 return ASCIIToUTF16("<span class='" + css_class + "'>") + |
77 net::EscapeForHTML(content) + ASCIIToUTF16("</span>"); | 78 net::EscapeForHTML(content) + ASCIIToUTF16("</span>"); |
78 } | 79 } |
79 | 80 |
80 } // namespace | 81 } // namespace |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); | 273 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); |
273 values->SetString("login_status_url", | 274 values->SetString("login_status_url", |
274 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 275 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
275 values->SetString("login_status_advanced", | 276 values->SetString("login_status_advanced", |
276 hide_sync ? string16() : | 277 hide_sync ? string16() : |
277 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 278 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
278 values->SetString("login_status_dismiss", | 279 values->SetString("login_status_dismiss", |
279 hide_sync ? string16() : | 280 hide_sync ? string16() : |
280 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 281 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
281 } | 282 } |
OLD | NEW |