| 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 21 matching lines...) Expand all Loading... |
| 32 ui::OSExchangeData data; | 32 ui::OSExchangeData data; |
| 33 BookmarkNodeData drag_data(nodes); | 33 BookmarkNodeData drag_data(nodes); |
| 34 drag_data.Write(profile->GetPath(), &data); | 34 drag_data.Write(profile->GetPath(), &data); |
| 35 | 35 |
| 36 // Allow nested message loop so we get DnD events as we drag this around. | 36 // Allow nested message loop so we get DnD events as we drag this around. |
| 37 bool was_nested = base::MessageLoop::current()->IsNested(); | 37 bool was_nested = base::MessageLoop::current()->IsNested(); |
| 38 base::MessageLoop::current()->SetNestableTasksAllowed(true); | 38 base::MessageLoop::current()->SetNestableTasksAllowed(true); |
| 39 | 39 |
| 40 int operation = ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK; | 40 int operation = ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK; |
| 41 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); | 41 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile); |
| 42 if (bookmark_utils::CanAllBeEditedByUser(model->client(), nodes)) | 42 if (bookmarks::CanAllBeEditedByUser(model->client(), nodes)) |
| 43 operation |= ui::DragDropTypes::DRAG_MOVE; | 43 operation |= ui::DragDropTypes::DRAG_MOVE; |
| 44 | 44 |
| 45 views::Widget* widget = views::Widget::GetWidgetForNativeView(view); | 45 views::Widget* widget = views::Widget::GetWidgetForNativeView(view); |
| 46 | 46 |
| 47 if (widget) { | 47 if (widget) { |
| 48 widget->RunShellDrag(NULL, data, gfx::Point(), operation, source); | 48 widget->RunShellDrag(NULL, data, gfx::Point(), operation, source); |
| 49 } else { | 49 } else { |
| 50 // We hit this case when we're using WebContentsViewWin or | 50 // We hit this case when we're using WebContentsViewWin or |
| 51 // WebContentsViewAura, instead of WebContentsViewViews. | 51 // WebContentsViewAura, instead of WebContentsViewViews. |
| 52 views::RunShellDrag(view, data, gfx::Point(), operation, source); | 52 views::RunShellDrag(view, data, gfx::Point(), operation, source); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (drop_parent->HasAncestor(node)) | 151 if (drop_parent->HasAncestor(node)) |
| 152 return false; | 152 return false; |
| 153 } | 153 } |
| 154 return true; | 154 return true; |
| 155 } | 155 } |
| 156 // From another profile, always accept. | 156 // From another profile, always accept. |
| 157 return true; | 157 return true; |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace chrome | 160 } // namespace chrome |
| OLD | NEW |