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

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

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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), 1.0f, false); 61 gfx::Canvas canvas(gfx::Size(kLength, kLength), ui::SCALE_FACTOR_100P,
62 false);
62 canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bmp), 0, 0); 63 canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bmp), 0, 0);
63 64
64 // Draw a gray border on the inside of the icon. 65 // Draw a gray border on the inside of the icon.
65 SkColor color = SkColorSetARGB(83, 0, 0, 0); 66 SkColor color = SkColorSetARGB(83, 0, 0, 0);
66 canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color); 67 canvas.DrawRect(gfx::Rect(0, 0, kLength - 1, kLength - 1), color);
67 68
68 return canvas.ExtractImageRep().sk_bitmap(); 69 return canvas.ExtractImageRep().sk_bitmap();
69 } 70 }
70 71
71 // Puts the |content| into a span with the given CSS class. 72 // Puts the |content| into a span with the given CSS class.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 values->SetString("login_status_message", message); 275 values->SetString("login_status_message", message);
275 values->SetString("login_status_url", 276 values->SetString("login_status_url",
276 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); 277 hide_sync ? std::string() : chrome::kSyncLearnMoreURL);
277 values->SetString("login_status_advanced", 278 values->SetString("login_status_advanced",
278 hide_sync ? string16() : 279 hide_sync ? string16() :
279 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); 280 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED));
280 values->SetString("login_status_dismiss", 281 values->SetString("login_status_dismiss",
281 hide_sync ? string16() : 282 hide_sync ? string16() :
282 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); 283 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK));
283 } 284 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698