Skip to content

Commit

Permalink
bookmarks: Move bookmark_pasteboard_helper_mac functions into 'bookma…
Browse files Browse the repository at this point in the history
…rks' namespace.

BUG=370433
TEST=unit_tests, components_unittests
R=avi@chromium.org

Review URL: https://codereview.chromium.org/814833007

Cr-Commit-Position: refs/heads/master@{#309417}
  • Loading branch information
tfarina authored and Commit bot committed Dec 22, 2014
1 parent b4d8c54 commit 6d64e0d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info {
if (![[self controller] draggingAllowed:info])
return NSDragOperationNone;
if ([[info draggingPasteboard] dataForType:kBookmarkButtonDragType] ||
PasteboardContainsBookmarks(ui::CLIPBOARD_TYPE_DRAG) ||
bookmarks::PasteboardContainsBookmarks(ui::CLIPBOARD_TYPE_DRAG) ||
[[info draggingPasteboard] containsURLData]) {
// Find the position of the drop indicator.
BOOL showIt = [[self controller]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)info {
if (![controller_ draggingAllowed:info])
return NSDragOperationNone;
if ([[info draggingPasteboard] dataForType:kBookmarkButtonDragType] ||
PasteboardContainsBookmarks(ui::CLIPBOARD_TYPE_DRAG) ||
bookmarks::PasteboardContainsBookmarks(ui::CLIPBOARD_TYPE_DRAG) ||
[[info draggingPasteboard] containsURLData]) {
// We only show the drop indicator if we're not in a position to
// perform a hover-open since it doesn't make sense to do both.
Expand Down
8 changes: 6 additions & 2 deletions components/bookmarks/browser/bookmark_pasteboard_helper_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@ namespace base {
class FilePath;
}

namespace bookmarks {

// This set of functions lets C++ code interact with the cocoa pasteboard and
// dragging methods.

// Writes a set of bookmark elements from a profile to the specified pasteboard.
void WriteBookmarksToPasteboard(
ui::ClipboardType type,
const std::vector<bookmarks::BookmarkNodeData::Element>& elements,
const std::vector<BookmarkNodeData::Element>& elements,
const base::FilePath& profile_path);

// Reads a set of bookmark elements from the specified pasteboard.
bool ReadBookmarksFromPasteboard(
ui::ClipboardType type,
std::vector<bookmarks::BookmarkNodeData::Element>& elements,
std::vector<BookmarkNodeData::Element>& elements,
base::FilePath* profile_path);

// Returns true if the specified pasteboard contains any sort of bookmark
// elements. It currently does not consider a plaintext url a valid bookmark.
bool PasteboardContainsBookmarks(ui::ClipboardType type);

} // namespace bookmarks

#if defined(__OBJC__)
// Pasteboard type for dictionary containing bookmark structure consisting
// of individual bookmark nodes and/or bookmark folders.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include "components/bookmarks/browser/bookmark_node.h"
#include "ui/base/clipboard/clipboard.h"

using bookmarks::BookmarkNodeData;

NSString* const kBookmarkDictionaryListPboardType =
@"BookmarkDictionaryListPboardType";

namespace bookmarks {

namespace {

// An unofficial standard pasteboard title type to be provided alongside the
Expand Down Expand Up @@ -331,3 +331,5 @@ bool PasteboardContainsBookmarks(ui::ClipboardType type) {
nil];
return [pb availableTypeFromArray:availableTypes] != nil;
}

} // namespace bookmarks

0 comments on commit 6d64e0d

Please sign in to comment.