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/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/bookmarks/bookmark_utils.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 return 0; | 214 return 0; |
215 if (ui::DragDropTypes::DRAG_COPY & common_ops) | 215 if (ui::DragDropTypes::DRAG_COPY & common_ops) |
216 return ui::DragDropTypes::DRAG_COPY; | 216 return ui::DragDropTypes::DRAG_COPY; |
217 if (ui::DragDropTypes::DRAG_LINK & common_ops) | 217 if (ui::DragDropTypes::DRAG_LINK & common_ops) |
218 return ui::DragDropTypes::DRAG_LINK; | 218 return ui::DragDropTypes::DRAG_LINK; |
219 if (ui::DragDropTypes::DRAG_MOVE & common_ops) | 219 if (ui::DragDropTypes::DRAG_MOVE & common_ops) |
220 return ui::DragDropTypes::DRAG_MOVE; | 220 return ui::DragDropTypes::DRAG_MOVE; |
221 return ui::DragDropTypes::DRAG_NONE; | 221 return ui::DragDropTypes::DRAG_NONE; |
222 } | 222 } |
223 | 223 |
224 int BookmarkDragOperation(const BookmarkNode* node) { | 224 int BookmarkDragOperation(Profile* profile, const BookmarkNode* node) { |
| 225 int move = ui::DragDropTypes::DRAG_MOVE; |
| 226 if (!profile->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled)) |
| 227 move = 0; |
225 if (node->is_url()) { | 228 if (node->is_url()) { |
226 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE | | 229 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK | move; |
227 ui::DragDropTypes::DRAG_LINK; | |
228 } | 230 } |
229 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE; | 231 return ui::DragDropTypes::DRAG_COPY | move; |
230 } | 232 } |
231 | 233 |
232 #if defined(TOOLKIT_VIEWS) | 234 #if defined(TOOLKIT_VIEWS) |
233 int BookmarkDropOperation(Profile* profile, | 235 int BookmarkDropOperation(Profile* profile, |
234 const views::DropTargetEvent& event, | 236 const views::DropTargetEvent& event, |
235 const BookmarkNodeData& data, | 237 const BookmarkNodeData& data, |
236 const BookmarkNode* parent, | 238 const BookmarkNode* parent, |
237 int index) { | 239 int index) { |
238 if (data.IsFromProfile(profile) && data.size() > 1) | 240 if (data.IsFromProfile(profile) && data.size() > 1) |
239 // Currently only accept one dragged node at a time. | 241 // Currently only accept one dragged node at a time. |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 return true; | 676 return true; |
675 | 677 |
676 for (int i = 0; i < node->child_count(); ++i) { | 678 for (int i = 0; i < node->child_count(); ++i) { |
677 if (NodeHasURLs(node->GetChild(i))) | 679 if (NodeHasURLs(node->GetChild(i))) |
678 return true; | 680 return true; |
679 } | 681 } |
680 return false; | 682 return false; |
681 } | 683 } |
682 | 684 |
683 } // namespace bookmark_utils | 685 } // namespace bookmark_utils |
OLD | NEW |