| Index: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
|
| diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
|
| index 20af670256c6f8d26329f0a443c8c89392b3bc33..9bf6aeebe7a0eee508a31dd0b60054436e27235c 100644
|
| --- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
|
| +++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
|
| @@ -44,7 +44,7 @@ const int kTitlePadding = 4;
|
| // necessary. This should be big enough so that the field pushes the right side
|
| // of the bubble far enough so that the edit button's left edge is to the right
|
| // of the field's left edge.
|
| -const int kMinimumFieldSize = 180;
|
| +const int kMinBubbleWidth = 336;
|
|
|
| } // namespace
|
|
|
| @@ -146,9 +146,9 @@ bool BookmarkBubbleView::AcceleratorPressed(
|
| }
|
|
|
| void BookmarkBubbleView::Init() {
|
| - remove_link_ = new views::Link(l10n_util::GetStringUTF16(
|
| + remove_button_ = new views::LabelButton(this, l10n_util::GetStringUTF16(
|
| IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK));
|
| - remove_link_->set_listener(this);
|
| + remove_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON);
|
|
|
| edit_button_ = new views::LabelButton(
|
| this, l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_OPTIONS));
|
| @@ -185,47 +185,49 @@ void BookmarkBubbleView::Init() {
|
| cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, GridLayout::USE_PREF,
|
| 0, 0);
|
|
|
| - // Middle (input field) rows.
|
| cs = layout->AddColumnSet(2);
|
| cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
|
| GridLayout::USE_PREF, 0, 0);
|
| cs->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
|
| - cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
|
| - GridLayout::USE_PREF, 0, kMinimumFieldSize);
|
|
|
| - // Bottom (buttons) row.
|
| - cs = layout->AddColumnSet(3);
|
| - cs->AddPaddingColumn(1, views::kRelatedControlHorizontalSpacing);
|
| + cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0,
|
| + GridLayout::USE_PREF, 0, 0);
|
| + cs->AddPaddingColumn(1, views::kUnrelatedControlLargeHorizontalSpacing);
|
| +
|
| cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0,
|
| GridLayout::USE_PREF, 0, 0);
|
| // We subtract 2 to account for the natural button padding, and
|
| // to bring the separation visually in line with the row separation
|
| // height.
|
| cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing - 2);
|
| +
|
| cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0,
|
| GridLayout::USE_PREF, 0, 0);
|
|
|
| layout->StartRow(0, 0);
|
| layout->AddView(title_label);
|
| - layout->AddView(remove_link_);
|
|
|
| layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
|
| +
|
| layout->StartRow(0, 2);
|
| views::Label* label = new views::Label(
|
| l10n_util::GetStringUTF16(IDS_BOOKMARK_BUBBLE_TITLE_TEXT));
|
| layout->AddView(label);
|
| title_tf_ = new views::Textfield();
|
| title_tf_->SetText(GetTitle());
|
| - layout->AddView(title_tf_);
|
| + layout->AddView(title_tf_, 5, 1);
|
|
|
| layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
|
|
|
| layout->StartRow(0, 2);
|
| layout->AddView(combobox_label);
|
| - layout->AddView(parent_combobox_);
|
| + layout->AddView(parent_combobox_, 5, 1);
|
| +
|
| layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
|
|
|
| - layout->StartRow(0, 3);
|
| + layout->StartRow(0, 2);
|
| + layout->SkipColumns(2);
|
| + layout->AddView(remove_button_);
|
| layout->AddView(edit_button_);
|
| layout->AddView(close_button_);
|
|
|
| @@ -246,7 +248,7 @@ BookmarkBubbleView::BookmarkBubbleView(views::View* anchor_view,
|
| BookmarkModelFactory::GetForProfile(profile_),
|
| BookmarkModelFactory::GetForProfile(profile_)->
|
| GetMostRecentlyAddedNodeForURL(url)),
|
| - remove_link_(NULL),
|
| + remove_button_(NULL),
|
| edit_button_(NULL),
|
| close_button_(NULL),
|
| title_tf_(NULL),
|
| @@ -269,21 +271,17 @@ string16 BookmarkBubbleView::GetTitle() {
|
| return string16();
|
| }
|
|
|
| +gfx::Size BookmarkBubbleView::GetMinimumSize() {
|
| + gfx::Size size(views::BubbleDelegateView::GetPreferredSize());
|
| + size.SetToMax(gfx::Size(kMinBubbleWidth, 0));
|
| + return size;
|
| +}
|
| +
|
| void BookmarkBubbleView::ButtonPressed(views::Button* sender,
|
| const ui::Event& event) {
|
| HandleButtonPressed(sender);
|
| }
|
|
|
| -void BookmarkBubbleView::LinkClicked(views::Link* source, int event_flags) {
|
| - DCHECK_EQ(remove_link_, source);
|
| - content::RecordAction(UserMetricsAction("BookmarkBubble_Unstar"));
|
| -
|
| - // Set this so we remove the bookmark after the window closes.
|
| - remove_bookmark_ = true;
|
| - apply_edits_ = false;
|
| - StartFade(false);
|
| -}
|
| -
|
| void BookmarkBubbleView::OnSelectedIndexChanged(views::Combobox* combobox) {
|
| if (combobox->selected_index() + 1 == parent_model_.GetItemCount()) {
|
| content::RecordAction(UserMetricsAction("BookmarkBubble_EditFromCombobox"));
|
| @@ -292,7 +290,13 @@ void BookmarkBubbleView::OnSelectedIndexChanged(views::Combobox* combobox) {
|
| }
|
|
|
| void BookmarkBubbleView::HandleButtonPressed(views::Button* sender) {
|
| - if (sender == edit_button_) {
|
| + if (sender == remove_button_) {
|
| + content::RecordAction(UserMetricsAction("BookmarkBubble_Unstar"));
|
| + // Set this so we remove the bookmark after the window closes.
|
| + remove_bookmark_ = true;
|
| + apply_edits_ = false;
|
| + StartFade(false);
|
| + } else if (sender == edit_button_) {
|
| content::RecordAction(UserMetricsAction("BookmarkBubble_Edit"));
|
| ShowEditor();
|
| } else {
|
|
|