| Index: chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
|
| diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
|
| index 7a3ffa6f68178a795ea628bc55b65c13d44b7879..0638b0a02ed2eb707dc03d4992010555871f99dd 100644
|
| --- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
|
| +++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc
|
| @@ -39,11 +39,9 @@
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/gfx/color_palette.h"
|
| -#include "ui/gfx/paint_vector_icon.h"
|
| #include "ui/gfx/text_utils.h"
|
| #include "ui/native_theme/common_theme.h"
|
| #include "ui/views/border.h"
|
| -#include "ui/views/controls/button/image_button.h"
|
| #include "ui/views/controls/image_view.h"
|
| #include "ui/views/controls/label.h"
|
| #include "ui/views/controls/link.h"
|
| @@ -667,6 +665,16 @@ gfx::Size ExpandableContainerView::DetailsView::GetPreferredSize() const {
|
| return gfx::Size(size.width(), size.height() * state_);
|
| }
|
|
|
| +// This is necessary for a subtle reason: views::BoxLayout only honors the
|
| +// preferred size of subviews when using horizontal layout; in vertical layout,
|
| +// it computes the width it should be, then calls |GetHeightForWidth()| on each
|
| +// of the subviews to size them vertically. Without this override, the logic in
|
| +// |GetPreferredSize()| to animate show/hide ends up ignored when this View is
|
| +// inside a BoxLayout.
|
| +int ExpandableContainerView::DetailsView::GetHeightForWidth(int width) const {
|
| + return views::View::GetHeightForWidth(width) * state_;
|
| +}
|
| +
|
| void ExpandableContainerView::DetailsView::AnimateToState(double state) {
|
| state_ = state;
|
| PreferredSizeChanged();
|
| @@ -682,64 +690,26 @@ ExpandableContainerView::ExpandableContainerView(
|
| : details_view_(NULL),
|
| slide_animation_(this),
|
| more_details_(NULL),
|
| - arrow_toggle_(NULL),
|
| expanded_(false) {
|
| - views::GridLayout* layout = new views::GridLayout(this);
|
| + views::BoxLayout* layout =
|
| + new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0);
|
| + layout->set_cross_axis_alignment(
|
| + views::BoxLayout::CROSS_AXIS_ALIGNMENT_START);
|
| SetLayoutManager(layout);
|
| - int column_set_id = 0;
|
| - views::ColumnSet* column_set = layout->AddColumnSet(column_set_id);
|
| - column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING,
|
| - 0, views::GridLayout::USE_PREF, 0, 0);
|
|
|
| if (details.empty())
|
| return;
|
|
|
| details_view_ = new DetailsView(horizontal_space, parent_bulleted);
|
| -
|
| - layout->StartRow(0, column_set_id);
|
| - layout->AddView(details_view_);
|
| -
|
| for (size_t i = 0; i < details.size(); ++i)
|
| details_view_->AddDetail(details[i]);
|
| + AddChildView(details_view_);
|
|
|
| - // Make sure the link width column is as wide as needed for both Show and
|
| - // Hide details, so that the arrow doesn't shift horizontally when we toggle.
|
| - views::Link* link = new views::Link(
|
| - l10n_util::GetStringUTF16(IDS_EXTENSIONS_HIDE_DETAILS));
|
| - int link_col_width = link->GetPreferredSize().width();
|
| - link->SetText(l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_DETAILS));
|
| - link_col_width = std::max(link_col_width, link->GetPreferredSize().width());
|
| -
|
| - column_set = layout->AddColumnSet(++column_set_id);
|
| - // Padding to the left of the More Details column.
|
| - column_set->AddPaddingColumn(0,
|
| - GetLeftPaddingForBulletedItems(parent_bulleted));
|
| - // The More Details column.
|
| - column_set->AddColumn(views::GridLayout::LEADING,
|
| - views::GridLayout::LEADING,
|
| - 0,
|
| - views::GridLayout::FIXED,
|
| - link_col_width,
|
| - link_col_width);
|
| - // The Up/Down arrow column.
|
| - column_set->AddColumn(views::GridLayout::LEADING,
|
| - views::GridLayout::TRAILING,
|
| - 0,
|
| - views::GridLayout::USE_PREF,
|
| - 0,
|
| - 0);
|
| -
|
| - // Add the More Details link.
|
| - layout->StartRow(0, column_set_id);
|
| - more_details_ = link;
|
| + more_details_ =
|
| + new views::Link(l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_DETAILS));
|
| more_details_->set_listener(this);
|
| more_details_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
|
| - layout->AddView(more_details_);
|
| -
|
| - // Add the arrow after the More Details link.
|
| - arrow_toggle_ = new views::ImageButton(this);
|
| - UpdateArrowToggle(false);
|
| - layout->AddView(arrow_toggle_);
|
| + AddChildView(more_details_);
|
| }
|
|
|
| ExpandableContainerView::~ExpandableContainerView() {
|
| @@ -763,8 +733,6 @@ void ExpandableContainerView::AnimationProgressed(
|
| }
|
|
|
| void ExpandableContainerView::AnimationEnded(const gfx::Animation* animation) {
|
| - if (arrow_toggle_)
|
| - UpdateArrowToggle(animation->GetCurrentValue() != 0.0);
|
| if (more_details_) {
|
| more_details_->SetText(expanded_ ?
|
| l10n_util::GetStringUTF16(IDS_EXTENSIONS_HIDE_DETAILS) :
|
| @@ -785,12 +753,6 @@ void ExpandableContainerView::ToggleDetailLevel() {
|
| slide_animation_.Show();
|
| }
|
|
|
| -void ExpandableContainerView::UpdateArrowToggle(bool expanded) {
|
| - gfx::ImageSkia icon = gfx::CreateVectorIcon(
|
| - expanded ? kCaretUpIcon : kCaretDownIcon, gfx::kChromeIconGrey);
|
| - arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon);
|
| -}
|
| -
|
| // static
|
| ExtensionInstallPrompt::ShowDialogCallback
|
| ExtensionInstallPrompt::GetViewsShowDialogCallback() {
|
|
|