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/cocoa/bookmarks/bookmark_drag_drop_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/bookmarks/bookmark_drag_drop_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 return drag_image; | 130 return drag_image; |
131 } | 131 } |
132 | 132 |
133 void DragBookmarks(Profile* profile, | 133 void DragBookmarks(Profile* profile, |
134 const std::vector<const BookmarkNode*>& nodes, | 134 const std::vector<const BookmarkNode*>& nodes, |
135 gfx::NativeView view) { | 135 gfx::NativeView view) { |
136 DCHECK(!nodes.empty()); | 136 DCHECK(!nodes.empty()); |
137 | 137 |
138 // Allow nested message loop so we get DnD events as we drag this around. | 138 // Allow nested message loop so we get DnD events as we drag this around. |
139 bool was_nested = MessageLoop::current()->IsNested(); | 139 bool was_nested = base::MessageLoop::current()->IsNested(); |
140 MessageLoop::current()->SetNestableTasksAllowed(true); | 140 base::MessageLoop::current()->SetNestableTasksAllowed(true); |
141 | 141 |
142 std::vector<BookmarkNodeData::Element> elements; | 142 std::vector<BookmarkNodeData::Element> elements; |
143 for (std::vector<const BookmarkNode*>::const_iterator it = nodes.begin(); | 143 for (std::vector<const BookmarkNode*>::const_iterator it = nodes.begin(); |
144 it != nodes.end(); ++it) { | 144 it != nodes.end(); ++it) { |
145 elements.push_back(BookmarkNodeData::Element(*it)); | 145 elements.push_back(BookmarkNodeData::Element(*it)); |
146 } | 146 } |
147 | 147 |
148 bookmark_pasteboard_helper_mac::WriteToPasteboard( | 148 bookmark_pasteboard_helper_mac::WriteToPasteboard( |
149 bookmark_pasteboard_helper_mac::kDragPasteboard, | 149 bookmark_pasteboard_helper_mac::kDragPasteboard, |
150 elements, | 150 elements, |
(...skipping 22 matching lines...) Expand all Loading... |
173 position.x -= std::floor(image_size.width / 2); | 173 position.x -= std::floor(image_size.width / 2); |
174 position.y -= std::floor(image_size.height / 5); | 174 position.y -= std::floor(image_size.height / 5); |
175 [window dragImage:drag_image | 175 [window dragImage:drag_image |
176 at:position | 176 at:position |
177 offset:NSZeroSize | 177 offset:NSZeroSize |
178 event:drag_event | 178 event:drag_event |
179 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] | 179 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] |
180 source:nil | 180 source:nil |
181 slideBack:YES]; | 181 slideBack:YES]; |
182 | 182 |
183 MessageLoop::current()->SetNestableTasksAllowed(was_nested); | 183 base::MessageLoop::current()->SetNestableTasksAllowed(was_nested); |
184 } | 184 } |
185 | 185 |
186 } // namespace chrome | 186 } // namespace chrome |
OLD | NEW |