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

Side by Side Diff: chrome/browser/ui/views/create_application_shortcut_view.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/views/create_application_shortcut_view.h" 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 SkIntToScalar(bounds.x()), 169 SkIntToScalar(bounds.x()),
170 SkIntToScalar(bounds.y()), 170 SkIntToScalar(bounds.y()),
171 SkIntToScalar(bounds.right()), 171 SkIntToScalar(bounds.right()),
172 SkIntToScalar(bounds.bottom()) 172 SkIntToScalar(bounds.bottom())
173 }; 173 };
174 174
175 SkPaint border_paint; 175 SkPaint border_paint;
176 border_paint.setAntiAlias(true); 176 border_paint.setAntiAlias(true);
177 border_paint.setARGB(0xFF, 0xC8, 0xC8, 0xC8); 177 border_paint.setARGB(0xFF, 0xC8, 0xC8, 0xC8);
178 178
179 canvas->AsCanvasSkia()->drawRoundRect( 179 canvas->GetSkCanvas()->drawRoundRect(
180 border_rect, SkIntToScalar(2), SkIntToScalar(2), border_paint); 180 border_rect, SkIntToScalar(2), SkIntToScalar(2), border_paint);
181 181
182 SkRect inner_rect = { 182 SkRect inner_rect = {
183 border_rect.fLeft + SkDoubleToScalar(0.5), 183 border_rect.fLeft + SkDoubleToScalar(0.5),
184 border_rect.fTop + SkDoubleToScalar(0.5), 184 border_rect.fTop + SkDoubleToScalar(0.5),
185 border_rect.fRight - SkDoubleToScalar(0.5), 185 border_rect.fRight - SkDoubleToScalar(0.5),
186 border_rect.fBottom - SkDoubleToScalar(0.5), 186 border_rect.fBottom - SkDoubleToScalar(0.5),
187 }; 187 };
188 188
189 SkPaint inner_paint; 189 SkPaint inner_paint;
190 inner_paint.setAntiAlias(true); 190 inner_paint.setAntiAlias(true);
191 inner_paint.setARGB(0xFF, 0xF8, 0xF8, 0xF8); 191 inner_paint.setARGB(0xFF, 0xF8, 0xF8, 0xF8);
192 canvas->AsCanvasSkia()->drawRoundRect( 192 canvas->GetSkCanvas()->drawRoundRect(
193 inner_rect, SkDoubleToScalar(1.5), SkDoubleToScalar(1.5), inner_paint); 193 inner_rect, SkDoubleToScalar(1.5), SkDoubleToScalar(1.5), inner_paint);
194 } 194 }
195 195
196 } // namespace 196 } // namespace
197 197
198 namespace browser { 198 namespace browser {
199 199
200 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, 200 void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window,
201 TabContentsWrapper* tab_contents) { 201 TabContentsWrapper* tab_contents) {
202 views::Widget::CreateWindowWithParent( 202 views::Widget::CreateWindowWithParent(
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 // Called by tracker_ when the app's icon is loaded. 525 // Called by tracker_ when the app's icon is loaded.
526 void CreateChromeApplicationShortcutView::OnImageLoaded( 526 void CreateChromeApplicationShortcutView::OnImageLoaded(
527 SkBitmap* image, const ExtensionResource& resource, int index) { 527 SkBitmap* image, const ExtensionResource& resource, int index) {
528 if (!image || image->isNull()) 528 if (!image || image->isNull())
529 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON); 529 image = ExtensionIconSource::LoadImageByResourceId(IDR_APP_DEFAULT_ICON);
530 530
531 shortcut_info_.favicon = *image; 531 shortcut_info_.favicon = *image;
532 CHECK(app_info_); 532 CHECK(app_info_);
533 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); 533 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon);
534 } 534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698