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

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

Issue 1978883002: In dialogs & dialog-like bubbles, make the escape button just close the prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/ssl_client_certificate_selector.h » ('j') | 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 <utility> 7 #include <utility>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return true; 136 return true;
137 } 137 }
138 if (key_code == ui::VKEY_E && accelerator.IsAltDown()) { 138 if (key_code == ui::VKEY_E && accelerator.IsAltDown()) {
139 HandleButtonPressed(edit_button_); 139 HandleButtonPressed(edit_button_);
140 return true; 140 return true;
141 } 141 }
142 if (key_code == ui::VKEY_R && accelerator.IsAltDown()) { 142 if (key_code == ui::VKEY_R && accelerator.IsAltDown()) {
143 HandleButtonPressed(remove_button_); 143 HandleButtonPressed(remove_button_);
144 return true; 144 return true;
145 } 145 }
146 if (key_code == ui::VKEY_ESCAPE) {
147 remove_bookmark_ = newly_bookmarked_;
148 apply_edits_ = false;
149 }
150 146
151 return LocationBarBubbleDelegateView::AcceleratorPressed(accelerator); 147 return LocationBarBubbleDelegateView::AcceleratorPressed(accelerator);
152 } 148 }
153 149
154 void BookmarkBubbleView::Init() { 150 void BookmarkBubbleView::Init() {
155 remove_button_ = new views::LabelButton(this, l10n_util::GetStringUTF16( 151 remove_button_ = new views::LabelButton(this, l10n_util::GetStringUTF16(
156 IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK)); 152 IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK));
157 remove_button_->SetStyle(views::Button::STYLE_BUTTON); 153 remove_button_->SetStyle(views::Button::STYLE_BUTTON);
158 154
159 edit_button_ = new views::LabelButton( 155 edit_button_ = new views::LabelButton(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 211
216 layout->StartRow(0, cs_id); 212 layout->StartRow(0, cs_id);
217 layout->SkipColumns(2); 213 layout->SkipColumns(2);
218 layout->AddView(remove_button_); 214 layout->AddView(remove_button_);
219 layout->AddView(edit_button_); 215 layout->AddView(edit_button_);
220 layout->AddView(close_button_); 216 layout->AddView(close_button_);
221 217
222 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); 218 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
223 AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN)); 219 AddAccelerator(ui::Accelerator(ui::VKEY_E, ui::EF_ALT_DOWN));
224 AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN)); 220 AddAccelerator(ui::Accelerator(ui::VKEY_R, ui::EF_ALT_DOWN));
225 AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
226 } 221 }
227 222
228 base::string16 BookmarkBubbleView::GetWindowTitle() const { 223 base::string16 BookmarkBubbleView::GetWindowTitle() const {
229 return l10n_util::GetStringUTF16(newly_bookmarked_ 224 return l10n_util::GetStringUTF16(newly_bookmarked_
230 ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED 225 ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED
231 : IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK); 226 : IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK);
232 } 227 }
233 228
234 const char* BookmarkBubbleView::GetClassName() const { 229 const char* BookmarkBubbleView::GetClassName() const {
235 return "BookmarkBubbleView"; 230 return "BookmarkBubbleView";
(...skipping 23 matching lines...) Expand all
259 bool newly_bookmarked) 254 bool newly_bookmarked)
260 : LocationBarBubbleDelegateView(anchor_view, nullptr), 255 : LocationBarBubbleDelegateView(anchor_view, nullptr),
261 observer_(observer), 256 observer_(observer),
262 delegate_(std::move(delegate)), 257 delegate_(std::move(delegate)),
263 profile_(profile), 258 profile_(profile),
264 url_(url), 259 url_(url),
265 newly_bookmarked_(newly_bookmarked), 260 newly_bookmarked_(newly_bookmarked),
266 parent_model_(BookmarkModelFactory::GetForProfile(profile_), 261 parent_model_(BookmarkModelFactory::GetForProfile(profile_),
267 BookmarkModelFactory::GetForProfile(profile_) 262 BookmarkModelFactory::GetForProfile(profile_)
268 ->GetMostRecentlyAddedUserNodeForURL(url)), 263 ->GetMostRecentlyAddedUserNodeForURL(url)),
269 remove_button_(NULL), 264 remove_button_(nullptr),
270 edit_button_(NULL), 265 edit_button_(nullptr),
271 close_button_(NULL), 266 close_button_(nullptr),
272 title_tf_(NULL), 267 title_tf_(nullptr),
273 parent_combobox_(NULL), 268 parent_combobox_(nullptr),
274 remove_bookmark_(false), 269 remove_bookmark_(false),
275 apply_edits_(true) {} 270 apply_edits_(true) {}
276 271
277 base::string16 BookmarkBubbleView::GetTitle() { 272 base::string16 BookmarkBubbleView::GetTitle() {
278 BookmarkModel* bookmark_model = 273 BookmarkModel* bookmark_model =
279 BookmarkModelFactory::GetForProfile(profile_); 274 BookmarkModelFactory::GetForProfile(profile_);
280 const BookmarkNode* node = 275 const BookmarkNode* node =
281 bookmark_model->GetMostRecentlyAddedUserNodeForURL(url_); 276 bookmark_model->GetMostRecentlyAddedUserNodeForURL(url_);
282 if (node) 277 if (node)
283 return node->GetTitle(); 278 return node->GetTitle();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 if (node) { 344 if (node) {
350 const base::string16 new_title = title_tf_->text(); 345 const base::string16 new_title = title_tf_->text();
351 if (new_title != node->GetTitle()) { 346 if (new_title != node->GetTitle()) {
352 model->SetTitle(node, new_title); 347 model->SetTitle(node, new_title);
353 content::RecordAction( 348 content::RecordAction(
354 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); 349 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble"));
355 } 350 }
356 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); 351 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index());
357 } 352 }
358 } 353 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/ssl_client_certificate_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698