Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Unified Diff: components/bookmarks/browser/bookmark_node_data.cc

Issue 634523004: Allow copying of multiple bookmarks from within the bookmark manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unused variable warning Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | components/bookmarks/browser/bookmark_node_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/bookmarks/browser/bookmark_node_data.cc
diff --git a/components/bookmarks/browser/bookmark_node_data.cc b/components/bookmarks/browser/bookmark_node_data.cc
index 8d0d1430d459eabccf34bf733897a5503642eaf8..28c588c72d8f5e60aa7d100f5adbf036c9eeab17 100644
--- a/components/bookmarks/browser/bookmark_node_data.cc
+++ b/components/bookmarks/browser/bookmark_node_data.cc
@@ -177,6 +177,22 @@ void BookmarkNodeData::WriteToClipboard(ui::ClipboardType clipboard_type) {
// on Linux (on Windows and Mac, there is no difference between these
// functions).
scw.WriteText(base::UTF8ToUTF16(url));
+ } else {
+ // We have either more than one URL, a folder, or a combination of URLs
+ // and folders.
+ base::string16 text;
+ for (size_t i = 0; i < elements.size(); i++) {
+ text += i == 0 ? base::ASCIIToUTF16("") : base::ASCIIToUTF16("\n");
+ if (!elements[i].is_url) {
+ // Then it's a folder. Only copy the name of the folder.
+ const base::string16 title = elements[i].title;
+ text += title;
+ } else {
+ const base::string16 url = base::UTF8ToUTF16(elements[i].url.spec());
+ text += url;
+ }
+ }
+ scw.WriteText(text);
}
Pickle pickle;
« no previous file with comments | « AUTHORS ('k') | components/bookmarks/browser/bookmark_node_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698