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

Side by Side Diff: chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc

Issue 1105413002: Avoid conversion of index to BookmarkNode pointer unnacessarily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 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
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/bookmarks/bookmark_context_menu_controller.h" 5 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 break; 193 break;
194 } 194 }
195 195
196 case IDC_BOOKMARK_BAR_REMOVE: { 196 case IDC_BOOKMARK_BAR_REMOVE: {
197 content::RecordAction( 197 content::RecordAction(
198 UserMetricsAction("BookmarkBar_ContextMenu_Remove")); 198 UserMetricsAction("BookmarkBar_ContextMenu_Remove"));
199 199
200 for (size_t i = 0; i < selection_.size(); ++i) { 200 for (size_t i = 0; i < selection_.size(); ++i) {
201 int index = selection_[i]->parent()->GetIndexOf(selection_[i]); 201 int index = selection_[i]->parent()->GetIndexOf(selection_[i]);
202 if (index > -1) 202 if (index > -1)
203 model_->Remove(selection_[i]->parent(), index); 203 model_->Remove(selection_[i]);
204 } 204 }
205 selection_.clear(); 205 selection_.clear();
206 break; 206 break;
207 } 207 }
208 208
209 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: { 209 case IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK: {
210 content::RecordAction( 210 content::RecordAction(
211 UserMetricsAction("BookmarkBar_ContextMenu_Add")); 211 UserMetricsAction("BookmarkBar_ContextMenu_Add"));
212 212
213 int index; 213 int index;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 bool BookmarkContextMenuController::GetAcceleratorForCommandId( 428 bool BookmarkContextMenuController::GetAcceleratorForCommandId(
429 int command_id, 429 int command_id,
430 ui::Accelerator* accelerator) { 430 ui::Accelerator* accelerator) {
431 return false; 431 return false;
432 } 432 }
433 433
434 void BookmarkContextMenuController::BookmarkModelChanged() { 434 void BookmarkContextMenuController::BookmarkModelChanged() {
435 if (delegate_) 435 if (delegate_)
436 delegate_->CloseMenu(); 436 delegate_->CloseMenu();
437 } 437 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/bookmarks_helper.cc ('k') | chrome/browser/ui/bookmarks/bookmark_ui_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698