OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_node_data.h" | 5 #include "components/bookmarks/browser/bookmark_node_data.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 BookmarkNodeData::~BookmarkNodeData() { | 114 BookmarkNodeData::~BookmarkNodeData() { |
115 } | 115 } |
116 | 116 |
117 #if !defined(OS_MACOSX) | 117 #if !defined(OS_MACOSX) |
118 // static | 118 // static |
119 bool BookmarkNodeData::ClipboardContainsBookmarks() { | 119 bool BookmarkNodeData::ClipboardContainsBookmarks() { |
120 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable( | 120 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable( |
121 ui::Clipboard::GetFormatType(kClipboardFormatString), | 121 ui::Clipboard::GetFormatType(kClipboardFormatString), |
122 ui::CLIPBOARD_TYPE_COPY_PASTE); | 122 ui::CLIPBOARD_TYPE_COPY_PASTE); |
123 } | 123 } |
124 | |
125 bool BookmarkNodeData::ClipboardContainsURLs() { | |
sky
2014/08/05 16:53:49
These functions don't need bookmarkNodeData at all
tfarina
2014/08/05 16:56:48
Scott, would you be fine with bookmark_clipboard.*
| |
126 return ui::Clipboard::GetForCurrentThread()->IsFormatAvailable( | |
127 ui::Clipboard::GetUrlWFormatType(), ui::CLIPBOARD_TYPE_COPY_PASTE); | |
128 } | |
129 | |
130 bool BookmarkNodeData::WriteBookmarkToClipboardFromURL() { | |
131 BookmarkNodeData data; | |
132 base::string16 url_text; | |
133 ui::Clipboard::GetForCurrentThread()->ReadText(ui::CLIPBOARD_TYPE_COPY_PASTE, | |
134 &url_text); | |
135 GURL url(url_text); | |
136 if (!data.ReadFromTuple(url, url_text)) | |
137 return false; | |
138 data.WriteToClipboard(ui::CLIPBOARD_TYPE_COPY_PASTE); | |
139 return true; | |
140 } | |
124 #endif | 141 #endif |
125 | 142 |
126 bool BookmarkNodeData::ReadFromVector( | 143 bool BookmarkNodeData::ReadFromVector( |
127 const std::vector<const BookmarkNode*>& nodes) { | 144 const std::vector<const BookmarkNode*>& nodes) { |
128 Clear(); | 145 Clear(); |
129 | 146 |
130 if (nodes.empty()) | 147 if (nodes.empty()) |
131 return false; | 148 return false; |
132 | 149 |
133 for (size_t i = 0; i < nodes.size(); ++i) | 150 for (size_t i = 0; i < nodes.size(); ++i) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 profile_path_ = profile_path; | 298 profile_path_ = profile_path; |
282 } | 299 } |
283 | 300 |
284 bool BookmarkNodeData::IsFromProfilePath( | 301 bool BookmarkNodeData::IsFromProfilePath( |
285 const base::FilePath& profile_path) const { | 302 const base::FilePath& profile_path) const { |
286 // An empty path means the data is not associated with any profile. | 303 // An empty path means the data is not associated with any profile. |
287 return !profile_path_.empty() && profile_path_ == profile_path; | 304 return !profile_path_.empty() && profile_path_ == profile_path; |
288 } | 305 } |
289 | 306 |
290 } // namespace bookmarks | 307 } // namespace bookmarks |
OLD | NEW |