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

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

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: fix windows Created 3 years, 9 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
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/views/extensions/extension_install_dialog_view.h" 5 #include "chrome/browser/ui/views/extensions/extension_install_dialog_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 224 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
225 225
226 if (prompt_->has_webstore_data()) { 226 if (prompt_->has_webstore_data()) {
227 layout->StartRow(0, column_set_id); 227 layout->StartRow(0, column_set_id);
228 views::View* rating = new views::View(); 228 views::View* rating = new views::View();
229 rating->SetLayoutManager(new views::BoxLayout( 229 rating->SetLayoutManager(new views::BoxLayout(
230 views::BoxLayout::kHorizontal, 0, 0, 0)); 230 views::BoxLayout::kHorizontal, 0, 0, 0));
231 layout->AddView(rating); 231 layout->AddView(rating);
232 prompt_->AppendRatingStars(AddResourceIcon, rating); 232 prompt_->AppendRatingStars(AddResourceIcon, rating);
233 233
234 const gfx::FontList& small_font_list = 234 views::TextContext rating_font, user_count_font;
235 rb.GetFontList(ui::ResourceBundle::SmallFont); 235 if (LayoutDelegate::Get()->IsHarmonyMode()) {
236 views::Label* rating_count = 236 rating_font = views::TextContext::DIALOG_MESSAGE;
237 new views::Label(prompt_->GetRatingCount(), small_font_list); 237 user_count_font = views::TextContext::DIALOG_TEXT_SMALL;
238 } else {
239 rating_font = user_count_font = views::TextContext::DEPRECATED_SMALL;
240 }
241 views::Label* rating_count = new views::Label(
242 prompt_->GetRatingCount(), rating_font, views::TextStyle::PRIMARY);
238 // Add some space between the stars and the rating count. 243 // Add some space between the stars and the rating count.
239 rating_count->SetBorder(views::CreateEmptyBorder(0, 2, 0, 0)); 244 rating_count->SetBorder(views::CreateEmptyBorder(0, 2, 0, 0));
240 rating->AddChildView(rating_count); 245 rating->AddChildView(rating_count);
241 246
242 layout->StartRow(0, column_set_id); 247 layout->StartRow(0, column_set_id);
243 views::Label* user_count = 248 views::Label* user_count = new views::Label(
244 new views::Label(prompt_->GetUserCount(), small_font_list); 249 prompt_->GetUserCount(), user_count_font, views::TextStyle::SECONDARY);
245 user_count->SetAutoColorReadabilityEnabled(false); 250 user_count->SetAutoColorReadabilityEnabled(false);
246 user_count->SetEnabledColor(SK_ColorGRAY); 251 user_count->SetEnabledColor(SK_ColorGRAY);
247 layout->AddView(user_count); 252 layout->AddView(user_count);
248 } 253 }
249 254
250 if (prompt_->ShouldShowPermissions()) { 255 if (prompt_->ShouldShowPermissions()) {
251 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 256 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
252 layout->StartRow(0, column_set_id); 257 layout->StartRow(0, column_set_id);
253 layout->AddView(new views::Separator(), 3, 1, views::GridLayout::FILL, 258 layout->AddView(new views::Separator(), 3, 1, views::GridLayout::FILL,
254 views::GridLayout::FILL); 259 views::GridLayout::FILL);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 0, LayoutDelegate::Get()->GetMetric( 440 0, LayoutDelegate::Get()->GetMetric(
436 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)); 441 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN));
437 column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING, 442 column_set->AddColumn(views::GridLayout::TRAILING, views::GridLayout::LEADING,
438 0, // no resizing 443 0, // no resizing
439 views::GridLayout::USE_PREF, 444 views::GridLayout::USE_PREF,
440 0, // no fixed width 445 0, // no fixed width
441 kIconSize); 446 kIconSize);
442 column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew); 447 column_set->AddPaddingColumn(0, views::kButtonHEdgeMarginNew);
443 448
444 layout->StartRow(0, column_set_id); 449 layout->StartRow(0, column_set_id);
445 views::Label* title = 450 views::Label* title = new views::Label(prompt_->GetDialogTitle(),
446 new views::Label(prompt_->GetDialogTitle(), 451 views::TextContext::DIALOG_TITLE);
447 ui::ResourceBundle::GetSharedInstance().GetFontList(
448 ui::ResourceBundle::MediumFont));
449 title->SetMultiLine(true); 452 title->SetMultiLine(true);
450 title->SetHorizontalAlignment(gfx::ALIGN_LEFT); 453 title->SetHorizontalAlignment(gfx::ALIGN_LEFT);
451 title->SizeToFit(left_column_width); 454 title->SizeToFit(left_column_width);
452 455
453 // Center align the title along the vertical axis. 456 // Center align the title along the vertical axis.
454 layout->AddView(title, 1, 1, views::GridLayout::LEADING, 457 layout->AddView(title, 1, 1, views::GridLayout::LEADING,
455 views::GridLayout::CENTER); 458 views::GridLayout::CENTER);
456 459
457 // Scale down to icon size, but allow smaller icons (don't scale up). 460 // Scale down to icon size, but allow smaller icons (don't scale up).
458 const gfx::ImageSkia* image = prompt_->icon().ToImageSkia(); 461 const gfx::ImageSkia* image = prompt_->icon().ToImageSkia();
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 gfx::ImageSkia icon = gfx::CreateVectorIcon( 743 gfx::ImageSkia icon = gfx::CreateVectorIcon(
741 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey); 744 expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey);
742 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); 745 arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon);
743 } 746 }
744 747
745 // static 748 // static
746 ExtensionInstallPrompt::ShowDialogCallback 749 ExtensionInstallPrompt::ShowDialogCallback
747 ExtensionInstallPrompt::GetViewsShowDialogCallback() { 750 ExtensionInstallPrompt::GetViewsShowDialogCallback() {
748 return base::Bind(&ShowExtensionInstallDialogImpl); 751 return base::Bind(&ShowExtensionInstallDialogImpl);
749 } 752 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698