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

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

Issue 386283002: Move bookmark_utils into bookmarks namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_drag_drop.h" 5 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h"
6 6
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/undo/bookmark_undo_service.h" 9 #include "chrome/browser/undo/bookmark_undo_service.h"
10 #include "chrome/browser/undo/bookmark_undo_service_factory.h" 10 #include "chrome/browser/undo/bookmark_undo_service_factory.h"
(...skipping 12 matching lines...) Expand all
23 int index, 23 int index,
24 bool copy) { 24 bool copy) {
25 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); 25 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile);
26 #if !defined(OS_ANDROID) 26 #if !defined(OS_ANDROID)
27 bookmarks::ScopedGroupBookmarkActions group_drops(model); 27 bookmarks::ScopedGroupBookmarkActions group_drops(model);
28 #endif 28 #endif
29 if (data.IsFromProfilePath(profile->GetPath())) { 29 if (data.IsFromProfilePath(profile->GetPath())) {
30 const std::vector<const BookmarkNode*> dragged_nodes = 30 const std::vector<const BookmarkNode*> dragged_nodes =
31 data.GetNodes(model, profile->GetPath()); 31 data.GetNodes(model, profile->GetPath());
32 DCHECK(model->client()->CanBeEditedByUser(parent_node)); 32 DCHECK(model->client()->CanBeEditedByUser(parent_node));
33 DCHECK(copy || bookmark_utils::CanAllBeEditedByUser(model->client(), 33 DCHECK(copy ||
34 dragged_nodes)); 34 bookmarks::CanAllBeEditedByUser(model->client(), dragged_nodes));
35 if (!dragged_nodes.empty()) { 35 if (!dragged_nodes.empty()) {
36 // Drag from same profile. Copy or move nodes. 36 // Drag from same profile. Copy or move nodes.
37 for (size_t i = 0; i < dragged_nodes.size(); ++i) { 37 for (size_t i = 0; i < dragged_nodes.size(); ++i) {
38 if (copy) { 38 if (copy) {
39 model->Copy(dragged_nodes[i], parent_node, index); 39 model->Copy(dragged_nodes[i], parent_node, index);
40 } else { 40 } else {
41 model->Move(dragged_nodes[i], parent_node, index); 41 model->Move(dragged_nodes[i], parent_node, index);
42 } 42 }
43 index = parent_node->GetIndexOf(dragged_nodes[i]) + 1; 43 index = parent_node->GetIndexOf(dragged_nodes[i]) + 1;
44 } 44 }
45 return copy ? ui::DragDropTypes::DRAG_COPY : ui::DragDropTypes::DRAG_MOVE; 45 return copy ? ui::DragDropTypes::DRAG_COPY : ui::DragDropTypes::DRAG_MOVE;
46 } 46 }
47 return ui::DragDropTypes::DRAG_NONE; 47 return ui::DragDropTypes::DRAG_NONE;
48 } 48 }
49 // Dropping a folder from different profile. Always accept. 49 // Dropping a folder from different profile. Always accept.
50 bookmark_utils::CloneBookmarkNode(model, data.elements, parent_node, 50 bookmarks::CloneBookmarkNode(model, data.elements, parent_node, index, true);
51 index, true);
52 return ui::DragDropTypes::DRAG_COPY; 51 return ui::DragDropTypes::DRAG_COPY;
53 } 52 }
54 53
55 } // namespace chrome 54 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698