| OLD | NEW |
| 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/bookmark_menu_controller_views.h" | 5 #include "chrome/browser/ui/views/bookmark_menu_controller_views.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_node_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 std::set<MenuItemView*> changed_parent_menus; | 381 std::set<MenuItemView*> changed_parent_menus; |
| 382 for (std::vector<const BookmarkNode*>::const_iterator i = bookmarks.begin(); | 382 for (std::vector<const BookmarkNode*>::const_iterator i = bookmarks.begin(); |
| 383 i != bookmarks.end(); ++i) { | 383 i != bookmarks.end(); ++i) { |
| 384 NodeToMenuIDMap::iterator node_to_menu = node_to_menu_id_map_.find(*i); | 384 NodeToMenuIDMap::iterator node_to_menu = node_to_menu_id_map_.find(*i); |
| 385 if (node_to_menu != node_to_menu_id_map_.end()) { | 385 if (node_to_menu != node_to_menu_id_map_.end()) { |
| 386 MenuItemView* menu = GetMenuByID(node_to_menu->second); | 386 MenuItemView* menu = GetMenuByID(node_to_menu->second); |
| 387 DCHECK(menu); // If there an entry in node_to_menu_id_map_, there should | 387 DCHECK(menu); // If there an entry in node_to_menu_id_map_, there should |
| 388 // be a menu. | 388 // be a menu. |
| 389 removed_menus->insert(menu); | 389 removed_menus->insert(menu); |
| 390 changed_parent_menus.insert(menu->GetParentMenuItem()); | 390 changed_parent_menus.insert(menu->GetParentMenuItem()); |
| 391 menu->GetParent()->RemoveChildView(menu); | 391 menu->parent()->RemoveChildView(menu); |
| 392 node_to_menu_id_map_.erase(node_to_menu); | 392 node_to_menu_id_map_.erase(node_to_menu); |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 | 395 |
| 396 // All the bookmarks in |bookmarks| should have the same parent. It's possible | 396 // All the bookmarks in |bookmarks| should have the same parent. It's possible |
| 397 // to support different parents, but this would need to prune any nodes whose | 397 // to support different parents, but this would need to prune any nodes whose |
| 398 // parent has been removed. As all nodes currently have the same parent, there | 398 // parent has been removed. As all nodes currently have the same parent, there |
| 399 // is the DCHECK. | 399 // is the DCHECK. |
| 400 DCHECK(changed_parent_menus.size() <= 1); | 400 DCHECK(changed_parent_menus.size() <= 1); |
| 401 | 401 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 415 break; | 415 break; |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 if (ancestor_removed) { | 418 if (ancestor_removed) { |
| 419 node_to_menu_id_map_.erase(i++); | 419 node_to_menu_id_map_.erase(i++); |
| 420 } else { | 420 } else { |
| 421 ++i; | 421 ++i; |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 } | 424 } |
| OLD | NEW |