| Index: components/bookmarks/browser/bookmark_utils.cc
|
| diff --git a/components/bookmarks/browser/bookmark_utils.cc b/components/bookmarks/browser/bookmark_utils.cc
|
| index 54a226f1faddf76494ecafe5a39f702a16cb3f81..bff1d49a681a474e32ebd9c4db61105058419a8c 100644
|
| --- a/components/bookmarks/browser/bookmark_utils.cc
|
| +++ b/components/bookmarks/browser/bookmark_utils.cc
|
| @@ -14,7 +14,6 @@
|
| #include "base/prefs/pref_service.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "base/time/time.h"
|
| -#include "components/bookmarks/browser/bookmark_client.h"
|
| #include "components/bookmarks/browser/bookmark_model.h"
|
| #include "components/bookmarks/browser/scoped_group_bookmark_actions.h"
|
| #include "components/bookmarks/common/bookmark_pref_names.h"
|
| @@ -204,13 +203,13 @@
|
| CloneBookmarkNode(model, bookmark_data.elements, parent, index, true);
|
| }
|
|
|
| -bool CanPasteFromClipboard(BookmarkModel* model, const BookmarkNode* node) {
|
| - if (!node || !model->client()->CanBeEditedByUser(node))
|
| +bool CanPasteFromClipboard(const BookmarkNode* node) {
|
| + if (!node)
|
| return false;
|
| return BookmarkNodeData::ClipboardContainsBookmarks();
|
| }
|
|
|
| -std::vector<const BookmarkNode*> GetMostRecentlyModifiedUserFolders(
|
| +std::vector<const BookmarkNode*> GetMostRecentlyModifiedFolders(
|
| BookmarkModel* model,
|
| size_t max_count) {
|
| std::vector<const BookmarkNode*> nodes;
|
| @@ -219,8 +218,6 @@
|
|
|
| while (iterator.has_next()) {
|
| const BookmarkNode* parent = iterator.Next();
|
| - if (!model->client()->CanBeEditedByUser(parent))
|
| - continue;
|
| if (parent->is_folder() && parent->date_folder_modified() > Time()) {
|
| if (max_count == 0) {
|
| nodes.push_back(parent);
|
| @@ -245,7 +242,7 @@
|
|
|
| for (int i = 0; i < root_node->child_count(); ++i) {
|
| const BookmarkNode* node = root_node->GetChild(i);
|
| - if (node->IsVisible() && model->client()->CanBeEditedByUser(node) &&
|
| + if (node->IsVisible() &&
|
| std::find(nodes.begin(), nodes.end(), node) == nodes.end()) {
|
| nodes.push_back(node);
|
|
|
| @@ -379,8 +376,11 @@
|
| void AddIfNotBookmarked(BookmarkModel* model,
|
| const GURL& url,
|
| const base::string16& title) {
|
| - if (IsBookmarkedByUser(model, url))
|
| - return; // Nothing to do, a user bookmark with that url already exists.
|
| + std::vector<const BookmarkNode*> bookmarks;
|
| + model->GetNodesByURL(url, &bookmarks);
|
| + if (!bookmarks.empty())
|
| + return; // Nothing to do, a bookmark with that url already exists.
|
| +
|
| model->client()->RecordAction(base::UserMetricsAction("BookmarkAdded"));
|
| const BookmarkNode* parent = model->GetParentForNewNodes();
|
| model->AddURL(parent, parent->child_count(), title, url);
|
| @@ -390,11 +390,11 @@
|
| std::vector<const BookmarkNode*> bookmarks;
|
| model->GetNodesByURL(url, &bookmarks);
|
|
|
| - // Remove all the user bookmarks.
|
| + // Remove all the bookmarks.
|
| for (size_t i = 0; i < bookmarks.size(); ++i) {
|
| const BookmarkNode* node = bookmarks[i];
|
| int index = node->parent()->GetIndexOf(node);
|
| - if (index > -1 && model->client()->CanBeEditedByUser(node))
|
| + if (index > -1)
|
| model->Remove(node->parent(), index);
|
| }
|
| }
|
| @@ -415,25 +415,6 @@
|
| return base::i18n::ToLower(title.substr(0u, kCleanedUpTitleMaxLength));
|
| }
|
|
|
| -bool CanAllBeEditedByUser(BookmarkClient* client,
|
| - const std::vector<const BookmarkNode*>& nodes) {
|
| - for (size_t i = 0; i < nodes.size(); ++i) {
|
| - if (!client->CanBeEditedByUser(nodes[i]))
|
| - return false;
|
| - }
|
| - return true;
|
| -}
|
| -
|
| -bool IsBookmarkedByUser(BookmarkModel* model, const GURL& url) {
|
| - std::vector<const BookmarkNode*> nodes;
|
| - model->GetNodesByURL(url, &nodes);
|
| - for (size_t i = 0; i < nodes.size(); ++i) {
|
| - if (model->client()->CanBeEditedByUser(nodes[i]))
|
| - return true;
|
| - }
|
| - return false;
|
| -}
|
| -
|
| } // namespace bookmark_utils
|
|
|
| const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) {
|
|
|