Home | History | Annotate | Download | only in bookmarks
      1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_drag_source.h"
      6 
      7 #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h"
      8 #include "chrome/browser/profiles/profile.h"
      9 #include "chrome/browser/tab_contents/tab_contents_view_mac.h"
     10 
     11 @implementation BookmarkDragSource
     12 
     13 - (id)initWithContentsView:(TabContentsViewCocoa*)contentsView
     14                   dropData:
     15                       (const std::vector<BookmarkNodeData::Element>&)dropData
     16                    profile:(Profile*)profile
     17                 pasteboard:(NSPasteboard*)pboard
     18          dragOperationMask:(NSDragOperation)dragOperationMask {
     19   self = [super initWithContentsView:contentsView
     20                            pasteboard:pboard
     21                     dragOperationMask:dragOperationMask];
     22   if (self) {
     23     dropData_ = dropData;
     24     profile_ = profile;
     25   }
     26 
     27   return self;
     28 }
     29 
     30 - (void)fillPasteboard {
     31   bookmark_pasteboard_helper_mac::WriteToDragClipboard(dropData_,
     32       profile_->GetPath().value());
     33 }
     34 
     35 - (NSImage*)dragImage {
     36   // TODO(feldstein): Do something better than this. Should have badging
     37   // and a single drag image.
     38   // http://crbug.com/37264
     39   return [NSImage imageNamed:NSImageNameMultipleDocuments];
     40 }
     41 
     42 @end  // @implementation BookmarkDragSource
     43 
     44