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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 namespace { | 52 namespace { |
53 | 53 |
54 SkBitmap GetGAIAPictureForNTP(const gfx::Image& image) { | 54 SkBitmap GetGAIAPictureForNTP(const gfx::Image& image) { |
55 // This value must match the width and height value of login-status-icon | 55 // This value must match the width and height value of login-status-icon |
56 // in new_tab.css. | 56 // in new_tab.css. |
57 const int kLength = 27; | 57 const int kLength = 27; |
58 SkBitmap bmp = skia::ImageOperations::Resize(*image.ToSkBitmap(), | 58 SkBitmap bmp = skia::ImageOperations::Resize(*image.ToSkBitmap(), |
59 skia::ImageOperations::RESIZE_BEST, kLength, kLength); | 59 skia::ImageOperations::RESIZE_BEST, kLength, kLength); |
60 | 60 |
61 gfx::Canvas canvas(gfx::Size(kLength, kLength), ui::SCALE_FACTOR_100P, | 61 gfx::Canvas canvas(gfx::Size(kLength, kLength), 1.0f, false); |
62 false); | |
63 canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bmp), 0, 0); | 62 canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bmp), 0, 0); |
64 | 63 |
65 // Draw a gray border on the inside of the icon. | 64 // Draw a gray border on the inside of the icon. |
66 SkColor color = SkColorSetARGB(83, 0, 0, 0); | 65 SkColor color = SkColorSetARGB(83, 0, 0, 0); |
67 canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color); | 66 canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color); |
68 | 67 |
69 return canvas.ExtractImageRep().sk_bitmap(); | 68 return canvas.ExtractImageRep().sk_bitmap(); |
70 } | 69 } |
71 | 70 |
72 // Puts the |content| into a span with the given CSS class. | 71 // Puts the |content| into a span with the given CSS class. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 values->SetString("login_status_message", message); | 274 values->SetString("login_status_message", message); |
276 values->SetString("login_status_url", | 275 values->SetString("login_status_url", |
277 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 276 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
278 values->SetString("login_status_advanced", | 277 values->SetString("login_status_advanced", |
279 hide_sync ? string16() : | 278 hide_sync ? string16() : |
280 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 279 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
281 values->SetString("login_status_dismiss", | 280 values->SetString("login_status_dismiss", |
282 hide_sync ? string16() : | 281 hide_sync ? string16() : |
283 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 282 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
284 } | 283 } |
OLD | NEW |