| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_drag_drop_views.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_drag_drop_views.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 base::MessageLoop::current()->SetNestableTasksAllowed(was_nested); | 57 base::MessageLoop::current()->SetNestableTasksAllowed(was_nested); |
| 58 } | 58 } |
| 59 | 59 |
| 60 int GetBookmarkDragOperation(content::BrowserContext* browser_context, | 60 int GetBookmarkDragOperation(content::BrowserContext* browser_context, |
| 61 const BookmarkNode* node) { | 61 const BookmarkNode* node) { |
| 62 PrefService* prefs = user_prefs::UserPrefs::Get(browser_context); | 62 PrefService* prefs = user_prefs::UserPrefs::Get(browser_context); |
| 63 Profile* profile = Profile::FromBrowserContext(browser_context); | 63 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 64 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); | 64 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); |
| 65 | 65 |
| 66 int move = ui::DragDropTypes::DRAG_MOVE; | 66 int move = ui::DragDropTypes::DRAG_MOVE; |
| 67 if (!prefs->GetBoolean(prefs::kEditBookmarksEnabled) || | 67 if (!prefs->GetBoolean(bookmarks::prefs::kEditBookmarksEnabled) || |
| 68 !model->client()->CanBeEditedByUser(node)) { | 68 !model->client()->CanBeEditedByUser(node)) { |
| 69 move = ui::DragDropTypes::DRAG_NONE; | 69 move = ui::DragDropTypes::DRAG_NONE; |
| 70 } | 70 } |
| 71 if (node->is_url()) | 71 if (node->is_url()) |
| 72 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK | move; | 72 return ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK | move; |
| 73 return ui::DragDropTypes::DRAG_COPY | move; | 73 return ui::DragDropTypes::DRAG_COPY | move; |
| 74 } | 74 } |
| 75 | 75 |
| 76 int GetPreferredBookmarkDropOperation(int source_operations, int operations) { | 76 int GetPreferredBookmarkDropOperation(int source_operations, int operations) { |
| 77 int common_ops = (source_operations & operations); | 77 int common_ops = (source_operations & operations); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 if (drop_parent->HasAncestor(node)) | 153 if (drop_parent->HasAncestor(node)) |
| 154 return false; | 154 return false; |
| 155 } | 155 } |
| 156 return true; | 156 return true; |
| 157 } | 157 } |
| 158 // From another profile, always accept. | 158 // From another profile, always accept. |
| 159 return true; | 159 return true; |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace chrome | 162 } // namespace chrome |
| OLD | NEW |