Index: components/bookmarks/browser/bookmark_utils.cc |
diff --git a/components/bookmarks/browser/bookmark_utils.cc b/components/bookmarks/browser/bookmark_utils.cc |
index 304d2befbd07d5b36d3286e8b1e24010a393f884..e33522191cc31447074d0d9dbb2b18e2213af1c6 100644 |
--- a/components/bookmarks/browser/bookmark_utils.cc |
+++ b/components/bookmarks/browser/bookmark_utils.cc |
@@ -12,6 +12,7 @@ |
#include "base/i18n/string_search.h" |
#include "base/metrics/user_metrics_action.h" |
#include "base/prefs/pref_service.h" |
+#include "base/strings/string_number_conversions.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/time/time.h" |
#include "components/bookmarks/browser/bookmark_client.h" |
@@ -201,6 +202,34 @@ void PasteFromClipboard(BookmarkModel* model, |
if (index == -1) |
index = parent->child_count(); |
ScopedGroupBookmarkActions group_paste(model); |
+ |
+ if (bookmark_data.elements.size() == 1 && |
+ model->IsBookmarked(bookmark_data.elements[0].url)) { |
+ std::vector<const BookmarkNode*> nodes; |
+ std::vector<base::string16> titles; |
+ std::vector<base::string16>::iterator it; |
+ base::string16 newTitle = bookmark_data.elements[0].title; |
tfarina
2014/08/13 13:40:52
new_title
but, pointing this style issues is gett
Deepak
2014/08/14 02:54:50
Done.
|
+ model->GetNodesByURLAndTitle(bookmark_data.elements[0].url, |
+ bookmark_data.elements[0].title, |
+ parent, |
+ &nodes, |
+ &titles); |
+ size_t i = 0; |
+ it = std::find(titles.begin(), titles.end(), newTitle); |
+ if (it == titles.end()) { |
+ newTitle = bookmark_data.elements[0].title; |
+ } else { |
+ for (i = 0; i < nodes.size(); i++) { |
+ newTitle = bookmark_data.elements[0].title + |
tfarina
2014/08/13 13:40:52
was this clang-formatted?
Deepak
2014/08/14 02:54:50
yes , I have used git cl format for making it form
|
+ base::UTF8ToUTF16("-Copy(") + base::IntToString16(i + 1) + |
+ base::UTF8ToUTF16(")"); |
+ it = std::find(titles.begin(), titles.end(), newTitle); |
+ if (it == titles.end()) |
+ break; |
+ } |
+ } |
+ bookmark_data.elements[0].title = newTitle; |
+ } |
CloneBookmarkNode(model, bookmark_data.elements, parent, index, true); |
} |