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/bookmarks/bookmark_drag_drop.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } // namespace | 48 } // namespace |
49 | 49 |
50 namespace chrome { | 50 namespace chrome { |
51 | 51 |
52 void DragBookmarks(Profile* profile, | 52 void DragBookmarks(Profile* profile, |
53 const std::vector<const BookmarkNode*>& nodes, | 53 const std::vector<const BookmarkNode*>& nodes, |
54 gfx::NativeView view, | 54 gfx::NativeView view, |
55 ui::DragDropTypes::DragEventSource source) { | 55 ui::DragDropTypes::DragEventSource source) { |
56 DCHECK(!nodes.empty()); | 56 DCHECK(!nodes.empty()); |
57 | 57 |
58 // Allow nested message loop so we get DnD events as we drag this around. | 58 // Allow nested run loop so we get DnD events as we drag this around. |
59 base::MessageLoop::ScopedNestableTaskAllower nestable_task_allower( | 59 base::MessageLoop::ScopedNestableTaskAllower nestable_task_allower( |
60 base::MessageLoop::current()); | 60 base::MessageLoop::current()); |
61 | 61 |
62 bookmarks::BookmarkNodeData drag_data(nodes); | 62 bookmarks::BookmarkNodeData drag_data(nodes); |
63 drag_data.SetOriginatingProfilePath(profile->GetPath()); | 63 drag_data.SetOriginatingProfilePath(profile->GetPath()); |
64 drag_data.WriteToClipboard(ui::CLIPBOARD_TYPE_DRAG); | 64 drag_data.WriteToClipboard(ui::CLIPBOARD_TYPE_DRAG); |
65 | 65 |
66 // Synthesize an event for dragging, since we can't be sure that | 66 // Synthesize an event for dragging, since we can't be sure that |
67 // [NSApp currentEvent] will return a valid dragging event. | 67 // [NSApp currentEvent] will return a valid dragging event. |
68 NSWindow* window = [view window]; | 68 NSWindow* window = [view window]; |
(...skipping 18 matching lines...) Expand all Loading... |
87 [window dragImage:drag_image | 87 [window dragImage:drag_image |
88 at:position | 88 at:position |
89 offset:NSZeroSize | 89 offset:NSZeroSize |
90 event:drag_event | 90 event:drag_event |
91 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] | 91 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] |
92 source:nil | 92 source:nil |
93 slideBack:YES]; | 93 slideBack:YES]; |
94 } | 94 } |
95 | 95 |
96 } // namespace chrome | 96 } // namespace chrome |
OLD | NEW |