| OLD | NEW |
| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/extension_install_dialog.h" | 9 #include "chrome/browser/extensions/extension_install_dialog.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // Heading font size correction. | 43 // Heading font size correction. |
| 44 #if defined(CROS_FONTS_USING_BCI) | 44 #if defined(CROS_FONTS_USING_BCI) |
| 45 const int kHeadingFontSizeDelta = 0; | 45 const int kHeadingFontSizeDelta = 0; |
| 46 #else | 46 #else |
| 47 const int kHeadingFontSizeDelta = 1; | 47 const int kHeadingFontSizeDelta = 1; |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 const int kRatingFontSizeDelta = -1; | 50 const int kRatingFontSizeDelta = -1; |
| 51 | 51 |
| 52 void AddResourceIcon(int resource_id, views::View* parent) { | 52 void AddResourceIcon(const SkBitmap* skia_image, void* data) { |
| 53 const SkBitmap* skia_image = ResourceBundle::GetSharedInstance(). | 53 views::View* parent = static_cast<views::View*>(data); |
| 54 GetBitmapNamed(resource_id); | |
| 55 views::ImageView* image_view = new views::ImageView(); | 54 views::ImageView* image_view = new views::ImageView(); |
| 56 image_view->SetImage(*skia_image); | 55 image_view->SetImage(*skia_image); |
| 57 parent->AddChildView(image_view); | 56 parent->AddChildView(image_view); |
| 58 } | 57 } |
| 59 | 58 |
| 60 } // namespace | 59 } // namespace |
| 61 | 60 |
| 62 // Implements the extension installation dialog for TOOLKIT_VIEWS. | 61 // Implements the extension installation dialog for TOOLKIT_VIEWS. |
| 63 class ExtensionInstallDialogView : public views::DialogDelegateView, | 62 class ExtensionInstallDialogView : public views::DialogDelegateView, |
| 64 public views::LinkListener { | 63 public views::LinkListener { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 icon_row_span = 3 + prompt.GetPermissionCount() * 2; | 187 icon_row_span = 3 + prompt.GetPermissionCount() * 2; |
| 189 } | 188 } |
| 190 layout->AddView(icon, 1, icon_row_span); | 189 layout->AddView(icon, 1, icon_row_span); |
| 191 | 190 |
| 192 if (is_inline_install()) { | 191 if (is_inline_install()) { |
| 193 layout->StartRow(0, column_set_id); | 192 layout->StartRow(0, column_set_id); |
| 194 views::View* rating = new views::View(); | 193 views::View* rating = new views::View(); |
| 195 rating->SetLayoutManager(new views::BoxLayout( | 194 rating->SetLayoutManager(new views::BoxLayout( |
| 196 views::BoxLayout::kHorizontal, 0, 0, 0)); | 195 views::BoxLayout::kHorizontal, 0, 0, 0)); |
| 197 layout->AddView(rating); | 196 layout->AddView(rating); |
| 198 prompt.AppendRatingStars( | 197 prompt.AppendRatingStars(AddResourceIcon, rating); |
| 199 reinterpret_cast<ExtensionInstallUI::Prompt::StarAppender>( | |
| 200 AddResourceIcon), | |
| 201 rating); | |
| 202 | 198 |
| 203 views::Label* rating_count = new views::Label( | 199 views::Label* rating_count = new views::Label( |
| 204 UTF16ToWide(prompt.GetRatingCount())); | 200 UTF16ToWide(prompt.GetRatingCount())); |
| 205 rating_count->SetFont( | 201 rating_count->SetFont( |
| 206 rating_count->font().DeriveFont(kRatingFontSizeDelta)); | 202 rating_count->font().DeriveFont(kRatingFontSizeDelta)); |
| 207 rating->AddChildView(rating_count); | 203 rating->AddChildView(rating_count); |
| 208 | 204 |
| 209 layout->StartRow(0, column_set_id); | 205 layout->StartRow(0, column_set_id); |
| 210 views::Label* user_count = new views::Label( | 206 views::Label* user_count = new views::Label( |
| 211 UTF16ToWide(prompt.GetUserCount())); | 207 UTF16ToWide(prompt.GetUserCount())); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } | 325 } |
| 330 | 326 |
| 331 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( | 327 ExtensionInstallDialogView* dialog = new ExtensionInstallDialogView( |
| 332 delegate, extension, icon, prompt); | 328 delegate, extension, icon, prompt); |
| 333 | 329 |
| 334 views::Widget* window = browser::CreateViewsWindow( | 330 views::Widget* window = browser::CreateViewsWindow( |
| 335 browser_window->GetNativeHandle(), dialog); | 331 browser_window->GetNativeHandle(), dialog); |
| 336 | 332 |
| 337 window->Show(); | 333 window->Show(); |
| 338 } | 334 } |
| OLD | NEW |