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

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: Attempt to fix unittest 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
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..2ed7de80b4c6bb48a6f5be7c3a185a6bba50502c 100644
--- a/components/bookmarks/browser/bookmark_node_data.cc
+++ b/components/bookmarks/browser/bookmark_node_data.cc
@@ -177,6 +177,21 @@ 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++) {
+ 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 += i == 0 ? title : base::ASCIIToUTF16("\n") + title;
sky 2014/10/20 20:37:11 nit: move the adding \n before the if.
hichris123 2014/10/20 23:12:59 Done.
+ } else {
+ const base::string16 url = base::UTF8ToUTF16(elements[i].url.spec());
+ text += i == 0 ? url : base::ASCIIToUTF16("\n") + url;
+ }
+ }
+ scw.WriteText(text);
}
Pickle pickle;

Powered by Google App Engine
This is Rietveld 408576698