Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1015)

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_login_handler.cc

Issue 10790128: Revert 147915 - Cleanup gfx::Canvas now that 10562027 has landed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/theme_helpers.cc ('k') | chrome/common/badge_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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), ui::SCALE_FACTOR_100P, 63 gfx::Canvas canvas(gfx::Size(kLength, kLength), false);
64 false);
65 canvas.DrawImageInt(bmp, 0, 0); 64 canvas.DrawImageInt(bmp, 0, 0);
66 65
67 // Draw a gray border on the inside of the icon. 66 // Draw a gray border on the inside of the icon.
68 SkColor color = SkColorSetARGB(83, 0, 0, 0); 67 SkColor color = SkColorSetARGB(83, 0, 0, 0);
69 canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color); 68 canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color);
70 69
71 return canvas.ExtractImageRep().sk_bitmap(); 70 return canvas.ExtractBitmap();
72 } 71 }
73 72
74 // Puts the |content| into a span with the given CSS class. 73 // Puts the |content| into a span with the given CSS class.
75 string16 CreateSpanWithClass(const string16& content, 74 string16 CreateSpanWithClass(const string16& content,
76 const std::string& css_class) { 75 const std::string& css_class) {
77 return ASCIIToUTF16("<span class='" + css_class + "'>") + 76 return ASCIIToUTF16("<span class='" + css_class + "'>") +
78 net::EscapeForHTML(content) + ASCIIToUTF16("</span>"); 77 net::EscapeForHTML(content) + ASCIIToUTF16("</span>");
79 } 78 }
80 79
81 } // namespace 80 } // namespace
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME))); 272 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)));
274 values->SetString("login_status_url", 273 values->SetString("login_status_url",
275 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); 274 hide_sync ? std::string() : chrome::kSyncLearnMoreURL);
276 values->SetString("login_status_advanced", 275 values->SetString("login_status_advanced",
277 hide_sync ? string16() : 276 hide_sync ? string16() :
278 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); 277 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED));
279 values->SetString("login_status_dismiss", 278 values->SetString("login_status_dismiss",
280 hide_sync ? string16() : 279 hide_sync ? string16() :
281 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); 280 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK));
282 } 281 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/theme_helpers.cc ('k') | chrome/common/badge_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698