Commit 6d64e0d9 authored by tfarina's avatar tfarina Committed by Commit bot

bookmarks: Move bookmark_pasteboard_helper_mac functions into 'bookmarks' 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}
parent b4d8c548
......@@ -57,7 +57,7 @@ using base::UserMetricsAction;
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]
......
......@@ -127,7 +127,7 @@ using base::UserMetricsAction;
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.
......
......@@ -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.
......
......@@ -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
......@@ -331,3 +331,5 @@ bool PasteboardContainsBookmarks(ui::ClipboardType type) {
nil];
return [pb availableTypeFromArray:availableTypes] != nil;
}
} // namespace bookmarks
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment