| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 const std::vector<const BookmarkNode*>& nodes, | 324 const std::vector<const BookmarkNode*>& nodes, |
| 325 gfx::NativeView view) { | 325 gfx::NativeView view) { |
| 326 DCHECK(!nodes.empty()); | 326 DCHECK(!nodes.empty()); |
| 327 | 327 |
| 328 #if defined(TOOLKIT_VIEWS) | 328 #if defined(TOOLKIT_VIEWS) |
| 329 // Set up our OLE machinery | 329 // Set up our OLE machinery |
| 330 ui::OSExchangeData data; | 330 ui::OSExchangeData data; |
| 331 BookmarkNodeData drag_data(nodes); | 331 BookmarkNodeData drag_data(nodes); |
| 332 drag_data.Write(profile, &data); | 332 drag_data.Write(profile, &data); |
| 333 | 333 |
| 334 views::RootView* root_view = | |
| 335 views::Widget::GetWidgetFromNativeView(view)->GetRootView(); | |
| 336 | |
| 337 // Allow nested message loop so we get DnD events as we drag this around. | 334 // Allow nested message loop so we get DnD events as we drag this around. |
| 338 bool was_nested = MessageLoop::current()->IsNested(); | 335 bool was_nested = MessageLoop::current()->IsNested(); |
| 339 MessageLoop::current()->SetNestableTasksAllowed(true); | 336 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 340 | 337 |
| 341 root_view->StartDragForViewFromMouseEvent(NULL, data, | 338 views::Widget* widget = views::Widget::GetWidgetFromNativeView(view); |
| 339 widget->StartDragForViewFromMouseEvent(NULL, data, |
| 342 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE | | 340 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_MOVE | |
| 343 ui::DragDropTypes::DRAG_LINK); | 341 ui::DragDropTypes::DRAG_LINK); |
| 344 | 342 |
| 345 MessageLoop::current()->SetNestableTasksAllowed(was_nested); | 343 MessageLoop::current()->SetNestableTasksAllowed(was_nested); |
| 346 #elif defined(OS_MACOSX) | 344 #elif defined(OS_MACOSX) |
| 347 // Allow nested message loop so we get DnD events as we drag this around. | 345 // Allow nested message loop so we get DnD events as we drag this around. |
| 348 bool was_nested = MessageLoop::current()->IsNested(); | 346 bool was_nested = MessageLoop::current()->IsNested(); |
| 349 MessageLoop::current()->SetNestableTasksAllowed(true); | 347 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 350 bookmark_pasteboard_helper_mac::StartDrag(profile, nodes, view); | 348 bookmark_pasteboard_helper_mac::StartDrag(profile, nodes, view); |
| 351 MessageLoop::current()->SetNestableTasksAllowed(was_nested); | 349 MessageLoop::current()->SetNestableTasksAllowed(was_nested); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 return true; | 667 return true; |
| 670 | 668 |
| 671 for (int i = 0; i < node->GetChildCount(); ++i) { | 669 for (int i = 0; i < node->GetChildCount(); ++i) { |
| 672 if (NodeHasURLs(node->GetChild(i))) | 670 if (NodeHasURLs(node->GetChild(i))) |
| 673 return true; | 671 return true; |
| 674 } | 672 } |
| 675 return false; | 673 return false; |
| 676 } | 674 } |
| 677 | 675 |
| 678 } // namespace bookmark_utils | 676 } // namespace bookmark_utils |
| OLD | NEW |