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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_install_dialog_view.cc

Issue 10453101: Convert most of the rest of chrome to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 <vector> 5 #include <vector>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 // Heading font size correction. 56 // Heading font size correction.
57 #if defined(CROS_FONTS_USING_BCI) 57 #if defined(CROS_FONTS_USING_BCI)
58 const int kHeadingFontSizeDelta = 0; 58 const int kHeadingFontSizeDelta = 0;
59 #else 59 #else
60 const int kHeadingFontSizeDelta = 1; 60 const int kHeadingFontSizeDelta = 1;
61 #endif 61 #endif
62 62
63 const int kRatingFontSizeDelta = -1; 63 const int kRatingFontSizeDelta = -1;
64 64
65 void AddResourceIcon(const SkBitmap* skia_image, void* data) { 65 void AddResourceIcon(const gfx::ImageSkia* skia_image, void* data) {
66 views::View* parent = static_cast<views::View*>(data); 66 views::View* parent = static_cast<views::View*>(data);
67 views::ImageView* image_view = new views::ImageView(); 67 views::ImageView* image_view = new views::ImageView();
68 image_view->SetImage(*skia_image); 68 image_view->SetImage(*skia_image);
69 parent->AddChildView(image_view); 69 parent->AddChildView(image_view);
70 } 70 }
71 71
72 } // namespace 72 } // namespace
73 73
74 // Implements the extension installation dialog for TOOLKIT_VIEWS. 74 // Implements the extension installation dialog for TOOLKIT_VIEWS.
75 class ExtensionInstallDialogView : public views::DialogDelegateView, 75 class ExtensionInstallDialogView : public views::DialogDelegateView,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 views::Label* heading = new views::Label(prompt.GetHeading()); 177 views::Label* heading = new views::Label(prompt.GetHeading());
178 heading->SetFont(heading->font().DeriveFont(kHeadingFontSizeDelta, 178 heading->SetFont(heading->font().DeriveFont(kHeadingFontSizeDelta,
179 gfx::Font::BOLD)); 179 gfx::Font::BOLD));
180 heading->SetMultiLine(true); 180 heading->SetMultiLine(true);
181 heading->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 181 heading->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
182 heading->SizeToFit(left_column_width); 182 heading->SizeToFit(left_column_width);
183 layout->AddView(heading); 183 layout->AddView(heading);
184 184
185 if (!is_bundle_install()) { 185 if (!is_bundle_install()) {
186 // Scale down to icon size, but allow smaller icons (don't scale up). 186 // Scale down to icon size, but allow smaller icons (don't scale up).
187 const SkBitmap* bitmap = prompt.icon().ToSkBitmap(); 187 const gfx::ImageSkia* image = prompt.icon().ToImageSkia();
188 gfx::Size size(bitmap->width(), bitmap->height()); 188 gfx::Size size(image->width(), image->height());
189 if (size.width() > kIconSize || size.height() > kIconSize) 189 if (size.width() > kIconSize || size.height() > kIconSize)
190 size = gfx::Size(kIconSize, kIconSize); 190 size = gfx::Size(kIconSize, kIconSize);
191 views::ImageView* icon = new views::ImageView(); 191 views::ImageView* icon = new views::ImageView();
192 icon->SetImageSize(size); 192 icon->SetImageSize(size);
193 icon->SetImage(*bitmap); 193 icon->SetImage(*image);
194 icon->SetHorizontalAlignment(views::ImageView::CENTER); 194 icon->SetHorizontalAlignment(views::ImageView::CENTER);
195 icon->SetVerticalAlignment(views::ImageView::CENTER); 195 icon->SetVerticalAlignment(views::ImageView::CENTER);
196 int icon_row_span = 1; 196 int icon_row_span = 1;
197 if (is_inline_install()) { 197 if (is_inline_install()) {
198 // Also span the rating, user_count and store_link rows. 198 // Also span the rating, user_count and store_link rows.
199 icon_row_span = 4; 199 icon_row_span = 4;
200 } else if (prompt.GetPermissionCount()) { 200 } else if (prompt.GetPermissionCount()) {
201 // Also span the permission header and each of the permission rows (all 201 // Also span the permission header and each of the permission rows (all
202 // have a padding row above it). 202 // have a padding row above it).
203 icon_row_span = 3 + prompt.GetPermissionCount() * 2; 203 icon_row_span = 3 + prompt.GetPermissionCount() * 2;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 return; 365 return;
366 } 366 }
367 367
368 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( 368 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView(
369 delegate, prompt); 369 delegate, prompt);
370 370
371 views::Widget* window = views::Widget::CreateWindowWithParent( 371 views::Widget* window = views::Widget::CreateWindowWithParent(
372 dialog, browser_window->GetNativeHandle()); 372 dialog, browser_window->GetNativeHandle());
373 window->Show(); 373 window->Show();
374 } 374 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/dropdown_bar_view.cc ('k') | chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698