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

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

Issue 7076027: Couple more wrench menu issues. The patch I sent around a couple of (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Makes unit test compile Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_menu_delegate.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/bookmarks/bookmark_node_data.h" 10 #include "chrome/browser/bookmarks/bookmark_node_data.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return result; 219 return result;
220 } 220 }
221 221
222 bool BookmarkMenuDelegate::ShowContextMenu(MenuItemView* source, 222 bool BookmarkMenuDelegate::ShowContextMenu(MenuItemView* source,
223 int id, 223 int id,
224 const gfx::Point& p, 224 const gfx::Point& p,
225 bool is_mouse_gesture) { 225 bool is_mouse_gesture) {
226 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); 226 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end());
227 std::vector<const BookmarkNode*> nodes; 227 std::vector<const BookmarkNode*> nodes;
228 nodes.push_back(menu_id_to_node_map_[id]); 228 nodes.push_back(menu_id_to_node_map_[id]);
229 bool close_on_delete = !parent_menu_item_ &&
230 (nodes[0]->parent() == profile()->GetBookmarkModel()->other_node() &&
231 nodes[0]->parent()->child_count() == 1);
229 context_menu_.reset( 232 context_menu_.reset(
230 new BookmarkContextMenu( 233 new BookmarkContextMenu(
231 parent_, 234 parent_,
232 profile_, 235 profile_,
233 page_navigator_, 236 page_navigator_,
234 nodes[0]->parent(), 237 nodes[0]->parent(),
235 nodes)); 238 nodes,
239 close_on_delete));
236 context_menu_->set_observer(this); 240 context_menu_->set_observer(this);
237 context_menu_->RunMenuAt(p); 241 context_menu_->RunMenuAt(p);
238 context_menu_.reset(NULL); 242 context_menu_.reset(NULL);
239 return true; 243 return true;
240 } 244 }
241 245
242 bool BookmarkMenuDelegate::CanDrag(MenuItemView* menu) { 246 bool BookmarkMenuDelegate::CanDrag(MenuItemView* menu) {
243 const BookmarkNode* node = menu_id_to_node_map_[menu->GetCommand()]; 247 const BookmarkNode* node = menu_id_to_node_map_[menu->GetCommand()];
244 // Don't let users drag the other folder. 248 // Don't let users drag the other folder.
245 return node->parent() != profile_->GetBookmarkModel()->root_node(); 249 return node->parent() != profile_->GetBookmarkModel()->root_node();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 break; 429 break;
426 } 430 }
427 } 431 }
428 if (ancestor_removed) { 432 if (ancestor_removed) {
429 node_to_menu_id_map_.erase(i++); 433 node_to_menu_id_map_.erase(i++);
430 } else { 434 } else {
431 ++i; 435 ++i;
432 } 436 }
433 } 437 }
434 } 438 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_context_menu_test.cc ('k') | chrome/browser/ui/views/wrench_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698