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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 441593002: Views: Implement keyboard shortcuts for the remove and edit button in the bookmark bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bookmarks/bookmark_bubble_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // destroyed asynchronously and the shown state will be checked before then. 118 // destroyed asynchronously and the shown state will be checked before then.
119 DCHECK_EQ(bookmark_bubble_, this); 119 DCHECK_EQ(bookmark_bubble_, this);
120 bookmark_bubble_ = NULL; 120 bookmark_bubble_ = NULL;
121 121
122 if (observer_) 122 if (observer_)
123 observer_->OnBookmarkBubbleHidden(); 123 observer_->OnBookmarkBubbleHidden();
124 } 124 }
125 125
126 bool BookmarkBubbleView::AcceleratorPressed( 126 bool BookmarkBubbleView::AcceleratorPressed(
127 const ui::Accelerator& accelerator) { 127 const ui::Accelerator& accelerator) {
128 if (accelerator.key_code() == ui::VKEY_RETURN) { 128 ui::KeyboardCode key_code = accelerator.key_code();
129 if (edit_button_->HasFocus()) 129 if (key_code == ui::VKEY_RETURN) {
sky 2014/08/04 17:12:03 I think we should keep return as we had it.
Lei Zhang 2014/08/04 18:59:57 The "if (edit_button_->HasFocus())" block doesn't
130 HandleButtonPressed(edit_button_); 130 HandleButtonPressed(close_button_);
131 else 131 return true;
132 HandleButtonPressed(close_button_); 132 } else if (key_code == ui::VKEY_ESCAPE) {
sky 2014/08/04 17:12:03 nit: no else after a return (here and your new cod
Lei Zhang 2014/08/04 19:05:55 Done.
133 return true;
134 } else if (accelerator.key_code() == ui::VKEY_ESCAPE) {
135 remove_bookmark_ = newly_bookmarked_; 133 remove_bookmark_ = newly_bookmarked_;
136 apply_edits_ = false; 134 apply_edits_ = false;
135 } else if (key_code == ui::VKEY_E && accelerator.IsAltDown()) {
136 HandleButtonPressed(edit_button_);
137 return true;
138 } else if (key_code == ui::VKEY_R && accelerator.IsAltDown()) {
139 HandleButtonPressed(remove_button_);
140 return true;
137 } 141 }
138 142
139 return BubbleDelegateView::AcceleratorPressed(accelerator); 143 return BubbleDelegateView::AcceleratorPressed(accelerator);
140 } 144 }
141 145
142 void BookmarkBubbleView::Init() { 146 void BookmarkBubbleView::Init() {
143 views::Label* title_label = new views::Label( 147 views::Label* title_label = new views::Label(
144 l10n_util::GetStringUTF16( 148 l10n_util::GetStringUTF16(
145 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : 149 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED :
146 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK)); 150 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 GridLayout::USE_PREF, 248 GridLayout::USE_PREF,
245 0, 249 0,
246 0); 250 0);
247 layout->StartRow(0, SYNC_PROMO_COLUMN_SET_ID); 251 layout->StartRow(0, SYNC_PROMO_COLUMN_SET_ID);
248 252
249 sync_promo_view_ = new BookmarkSyncPromoView(delegate_.get()); 253 sync_promo_view_ = new BookmarkSyncPromoView(delegate_.get());
250 layout->AddView(sync_promo_view_); 254 layout->AddView(sync_promo_view_);
251 } 255 }
252 256
253 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); 257 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
258 AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN));
259 AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN));
254 } 260 }
255 261
256 BookmarkBubbleView::BookmarkBubbleView( 262 BookmarkBubbleView::BookmarkBubbleView(
257 views::View* anchor_view, 263 views::View* anchor_view,
258 BookmarkBubbleViewObserver* observer, 264 BookmarkBubbleViewObserver* observer,
259 scoped_ptr<BookmarkBubbleDelegate> delegate, 265 scoped_ptr<BookmarkBubbleDelegate> delegate,
260 Profile* profile, 266 Profile* profile,
261 const GURL& url, 267 const GURL& url,
262 bool newly_bookmarked) 268 bool newly_bookmarked)
263 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), 269 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 if (node) { 362 if (node) {
357 const base::string16 new_title = title_tf_->text(); 363 const base::string16 new_title = title_tf_->text();
358 if (new_title != node->GetTitle()) { 364 if (new_title != node->GetTitle()) {
359 model->SetTitle(node, new_title); 365 model->SetTitle(node, new_title);
360 content::RecordAction( 366 content::RecordAction(
361 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); 367 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"));
362 } 368 }
363 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); 369 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index());
364 } 370 }
365 } 371 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698