| 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..3f64014c17b0675df1327eeb0b9c34530e60d6e1 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,33 @@ 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 new_title = bookmark_data.elements[0].title;
|
| + 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(), new_title);
|
| + if (it == titles.end()) {
|
| + new_title = bookmark_data.elements[0].title;
|
| + } else {
|
| + for (i = 0; i < nodes.size(); i++) {
|
| + new_title = bookmark_data.elements[0].title + base::UTF8ToUTF16("(") +
|
| + base::IntToString16(i + 1) + base::UTF8ToUTF16(")");
|
| + it = std::find(titles.begin(), titles.end(), new_title);
|
| + if (it == titles.end())
|
| + break;
|
| + }
|
| + }
|
| + bookmark_data.elements[0].title = new_title;
|
| + }
|
| CloneBookmarkNode(model, bookmark_data.elements, parent, index, true);
|
| }
|
|
|
|
|