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/app_launcher_login_handler.h" | 5 #include "chrome/browser/ui/webui/app_launcher_login_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 using content::Referrer; | 52 using content::Referrer; |
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 SkCanvas canvas(bmp); |
62 | 63 |
63 // Draw a gray border on the inside of the icon. | 64 // Draw a gray border on the inside of the icon. |
64 sk_sp<SkSurface> surface = | |
65 SkSurface::MakeRasterDirect(bmp.info(), bmp.getPixels(), bmp.rowBytes()); | |
66 SkPaint paint; | 65 SkPaint paint; |
67 paint.setColor(SkColorSetARGB(83, 0, 0, 0)); | 66 paint.setColor(SkColorSetARGB(83, 0, 0, 0)); |
68 paint.setStyle(SkPaint::kStroke_Style); | 67 paint.setStyle(SkPaint::kStroke_Style); |
69 surface->getCanvas()->drawRect( | 68 canvas.drawRect(gfx::RectToSkRect(gfx::Rect(kLength - 1, kLength - 1)), |
70 gfx::RectToSkRect(gfx::Rect(kLength - 1, kLength - 1)), paint); | 69 paint); |
71 return bmp; | 70 return bmp; |
72 } | 71 } |
73 | 72 |
74 // Puts the |content| into an element with the given CSS class. | 73 // Puts the |content| into an element with the given CSS class. |
75 base::string16 CreateElementWithClass(const base::string16& content, | 74 base::string16 CreateElementWithClass(const base::string16& content, |
76 const std::string& tag_name, | 75 const std::string& tag_name, |
77 const std::string& css_class, | 76 const std::string& css_class, |
78 const std::string& extends_tag) { | 77 const std::string& extends_tag) { |
79 base::string16 start_tag = base::ASCIIToUTF16("<" + tag_name + | 78 base::string16 start_tag = base::ASCIIToUTF16("<" + tag_name + |
80 " class='" + css_class + "' is='" + extends_tag + "'>"); | 79 " class='" + css_class + "' is='" + extends_tag + "'>"); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 values->SetString("login_status_message", message); | 255 values->SetString("login_status_message", message); |
257 values->SetString("login_status_url", | 256 values->SetString("login_status_url", |
258 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); | 257 hide_sync ? std::string() : chrome::kSyncLearnMoreURL); |
259 values->SetString("login_status_advanced", | 258 values->SetString("login_status_advanced", |
260 hide_sync ? base::string16() : | 259 hide_sync ? base::string16() : |
261 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); | 260 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_ADVANCED)); |
262 values->SetString("login_status_dismiss", | 261 values->SetString("login_status_dismiss", |
263 hide_sync ? base::string16() : | 262 hide_sync ? base::string16() : |
264 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); | 263 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_NTP_BUBBLE_OK)); |
265 } | 264 } |
OLD | NEW |