OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/bookmarks/bookmark_pasteboard_helper_mac.h" | 5 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
11 #include "base/memory/scoped_nsobject.h" | 11 #include "base/memory/scoped_nsobject.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" | 16 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" |
16 #include "grit/ui_resources.h" | 17 #include "grit/ui_resources.h" |
17 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/gfx/mac/nsimage_cache.h" | 19 #include "ui/gfx/mac/nsimage_cache.h" |
19 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 20 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
20 | 21 |
21 NSString* const kBookmarkDictionaryListPboardType = | 22 NSString* const kBookmarkDictionaryListPboardType = |
22 @"BookmarkDictionaryListPboardType"; | 23 @"BookmarkDictionaryListPboardType"; |
23 | 24 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 location:position | 416 location:position |
416 modifierFlags:NSLeftMouseDraggedMask | 417 modifierFlags:NSLeftMouseDraggedMask |
417 timestamp:event_time | 418 timestamp:event_time |
418 windowNumber:[window windowNumber] | 419 windowNumber:[window windowNumber] |
419 context:nil | 420 context:nil |
420 eventNumber:0 | 421 eventNumber:0 |
421 clickCount:1 | 422 clickCount:1 |
422 pressure:1.0]; | 423 pressure:1.0]; |
423 | 424 |
424 // TODO(avi): Do better than this offset. | 425 // TODO(avi): Do better than this offset. |
425 NSImage* drag_image = MakeDragImage(profile->GetBookmarkModel(), nodes); | 426 NSImage* drag_image = |
| 427 MakeDragImage(BookmarkModelFactory::GetForProfile(profile), nodes); |
426 NSSize image_size = [drag_image size]; | 428 NSSize image_size = [drag_image size]; |
427 position.x -= std::floor(image_size.width / 2); | 429 position.x -= std::floor(image_size.width / 2); |
428 position.y -= std::floor(image_size.height / 5); | 430 position.y -= std::floor(image_size.height / 5); |
429 [window dragImage:drag_image | 431 [window dragImage:drag_image |
430 at:position | 432 at:position |
431 offset:NSZeroSize | 433 offset:NSZeroSize |
432 event:drag_event | 434 event:drag_event |
433 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] | 435 pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard] |
434 source:nil | 436 source:nil |
435 slideBack:YES]; | 437 slideBack:YES]; |
436 } | 438 } |
437 | 439 |
438 } // namespace bookmark_pasteboard_helper_mac | 440 } // namespace bookmark_pasteboard_helper_mac |
OLD | NEW |