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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 16279002: bookmarks: Convert "Remove" link into a LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a bunch of changes Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3c698320f7f2c796148ba3b81b9cd12b1748755c 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc
@@ -37,14 +37,14 @@ using views::GridLayout;
namespace {
-// Padding between "Title:" and the actual title.
-const int kTitlePadding = 4;
+// Minimum size of the bubble. This is used to shrink the width of the bubble
msw 2013/06/01 18:04:38 Actually, this minimum width is clamping the bubbl
tfarina 2013/06/01 19:43:37 Done.
+// in order to reduce/compress the size of the textfields and thus the size
+// of the "Remove" button, otherwise they just look big and ugly.
+const int kMinBubbleWidth = 336;
-// Minimum width for the fields - they will push out the size of the bubble if
-// 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;
+// The padding used between textfield and combobox and between combobox and the
+// button's row.
+const int kVerticalSpacing = 10;
} // 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));
@@ -176,7 +176,8 @@ void BookmarkBubbleView::Init() {
GridLayout* layout = new GridLayout(this);
SetLayoutManager(layout);
- ColumnSet* cs = layout->AddColumnSet(0);
+ const int kFirstColumnSetID = 0;
+ ColumnSet* cs = layout->AddColumnSet(kFirstColumnSetID);
// Top (title) row.
msw 2013/06/01 18:04:38 Still hoping you'll use the bubble's title feature
tfarina 2013/06/01 19:43:37 Done.
cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, GridLayout::USE_PREF,
@@ -185,17 +186,17 @@ void BookmarkBubbleView::Init() {
cs->AddColumn(GridLayout::CENTER, GridLayout::CENTER, 0, GridLayout::USE_PREF,
0, 0);
- // Middle (input field) rows.
- cs = layout->AddColumnSet(2);
+ // The column layout used for middle and bottom rows.
+ const int kSecondColumnSetID = 1;
+ cs = layout->AddColumnSet(kSecondColumnSetID);
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);
+ cs->AddPaddingColumn(0, views::kUnrelatedControlHorizontalSpacing);
+
+ cs->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0,
+ GridLayout::USE_PREF, 0, 0);
+ cs->AddPaddingColumn(1, views::kUnrelatedControlLargeHorizontalSpacing);
- // Bottom (buttons) row.
- cs = layout->AddColumnSet(3);
- cs->AddPaddingColumn(1, views::kRelatedControlHorizontalSpacing);
cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0,
GridLayout::USE_PREF, 0, 0);
// We subtract 2 to account for the natural button padding, and
@@ -205,27 +206,29 @@ void BookmarkBubbleView::Init() {
cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0,
GridLayout::USE_PREF, 0, 0);
- layout->StartRow(0, 0);
+ layout->StartRow(0, kFirstColumnSetID);
layout->AddView(title_label);
- layout->AddView(remove_link_);
-
layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
- layout->StartRow(0, 2);
+
+ layout->StartRow(0, kSecondColumnSetID);
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->AddPaddingRow(0, kVerticalSpacing);
- layout->StartRow(0, 2);
+ layout->StartRow(0, kSecondColumnSetID);
layout->AddView(combobox_label);
- layout->AddView(parent_combobox_);
- layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
+ layout->AddView(parent_combobox_, 5, 1);
- layout->StartRow(0, 3);
+ layout->AddPaddingRow(0, kVerticalSpacing);
+
+ layout->StartRow(0, kSecondColumnSetID);
+ layout->SkipColumns(2);
+ layout->AddView(remove_button_);
layout->AddView(edit_button_);
layout->AddView(close_button_);
@@ -246,13 +249,17 @@ 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),
parent_combobox_(NULL),
remove_bookmark_(false),
apply_edits_(true) {
+ set_margins(gfx::Insets(13,
msw 2013/06/01 18:04:38 reduce the top inset here (probably to 0), if you'
tfarina 2013/06/01 19:43:37 Done.
+ views::kUnrelatedControlLargeHorizontalSpacing,
+ views::kUnrelatedControlVerticalSpacing,
+ views::kUnrelatedControlLargeHorizontalSpacing));
// Compensate for built-in vertical padding in the anchor view's image.
set_anchor_view_insets(gfx::Insets(5, 0, 5, 0));
}
@@ -269,21 +276,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 +295,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 {
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698