summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks/bookmark_node_data_mac.cc
blob: 0400e250c29b7fd4fb3b65c903caed4069f4e30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/bookmarks/bookmark_node_data.h"

#include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h"

// static
bool BookmarkNodeData::ClipboardContainsBookmarks() {
  return bookmark_pasteboard_helper_mac::PasteboardContainsBookmarks(
      bookmark_pasteboard_helper_mac::kCopyPastePasteboard);
}

void BookmarkNodeData::WriteToClipboard() const {
  bookmark_pasteboard_helper_mac::WriteToPasteboard(
      bookmark_pasteboard_helper_mac::kCopyPastePasteboard,
      elements,
      profile_path_);
}

bool BookmarkNodeData::ReadFromClipboard() {
  base::FilePath file_path;
  if (!bookmark_pasteboard_helper_mac::ReadFromPasteboard(
          bookmark_pasteboard_helper_mac::kCopyPastePasteboard,
          elements,
          &file_path)) {
    return false;
  }

  profile_path_ = file_path;
  return true;
}

bool BookmarkNodeData::ReadFromDragClipboard() {
  base::FilePath file_path;
  if (!bookmark_pasteboard_helper_mac::ReadFromPasteboard(
          bookmark_pasteboard_helper_mac::kDragPasteboard,
          elements,
          &file_path)) {
    return false;
  }

  profile_path_ = file_path;
  return true;
}