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

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

Issue 12475013: bookmarks: Extract PerformBookmarkDrop() function out of bookmark_utils.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chromeos fixes Created 7 years, 9 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) 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_menu_delegate.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.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_model_factory.h" 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
11 #include "chrome/browser/bookmarks/bookmark_node_data.h" 11 #include "chrome/browser/bookmarks/bookmark_node_data.h"
12 #include "chrome/browser/bookmarks/bookmark_utils.h" 12 #include "chrome/browser/bookmarks/bookmark_utils.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h"
14 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 15 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 17 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
17 #include "chrome/browser/ui/views/bookmarks/bookmark_drag_drop.h" 18 #include "chrome/browser/ui/views/bookmarks/bookmark_drag_drop_views.h"
18 #include "chrome/browser/ui/views/event_utils.h" 19 #include "chrome/browser/ui/views/event_utils.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "content/public/browser/page_navigator.h" 21 #include "content/public/browser/page_navigator.h"
21 #include "content/public/browser/user_metrics.h" 22 #include "content/public/browser/user_metrics.h"
22 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
23 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
24 #include "grit/ui_resources.h" 25 #include "grit/ui_resources.h"
25 #include "ui/base/dragdrop/os_exchange_data.h" 26 #include "ui/base/dragdrop/os_exchange_data.h"
26 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
27 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // This can happen with SHOW_PERMANENT_FOLDERS. 261 // This can happen with SHOW_PERMANENT_FOLDERS.
261 drop_parent = model->bookmark_bar_node(); 262 drop_parent = model->bookmark_bar_node();
262 index_to_drop_at = drop_parent->child_count(); 263 index_to_drop_at = drop_parent->child_count();
263 } 264 }
264 break; 265 break;
265 266
266 default: 267 default:
267 break; 268 break;
268 } 269 }
269 270
270 int result = bookmark_utils::PerformBookmarkDrop( 271 return chrome::DropBookmarks(profile_, drop_data_,
271 profile_, drop_data_, drop_parent, index_to_drop_at); 272 drop_parent, index_to_drop_at);
272 return result;
273 } 273 }
274 274
275 bool BookmarkMenuDelegate::ShowContextMenu(MenuItemView* source, 275 bool BookmarkMenuDelegate::ShowContextMenu(MenuItemView* source,
276 int id, 276 int id,
277 const gfx::Point& p, 277 const gfx::Point& p,
278 bool is_mouse_gesture) { 278 bool is_mouse_gesture) {
279 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end()); 279 DCHECK(menu_id_to_node_map_.find(id) != menu_id_to_node_map_.end());
280 std::vector<const BookmarkNode*> nodes; 280 std::vector<const BookmarkNode*> nodes;
281 nodes.push_back(menu_id_to_node_map_[id]); 281 nodes.push_back(menu_id_to_node_map_[id]);
282 bool close_on_delete = !parent_menu_item_ && 282 bool close_on_delete = !parent_menu_item_ &&
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) { 497 MenuItemView* BookmarkMenuDelegate::GetMenuByID(int id) {
498 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin()); 498 for (NodeToMenuMap::const_iterator i(node_to_menu_map_.begin());
499 i != node_to_menu_map_.end(); ++i) { 499 i != node_to_menu_map_.end(); ++i) {
500 MenuItemView* menu = i->second->GetMenuItemByID(id); 500 MenuItemView* menu = i->second->GetMenuItemByID(id);
501 if (menu) 501 if (menu)
502 return menu; 502 return menu;
503 } 503 }
504 504
505 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL; 505 return parent_menu_item_ ? parent_menu_item_->GetMenuItemByID(id) : NULL;
506 } 506 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_drag_drop_views.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698