OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_UTILS_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_UTILS_H_ |
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_UTILS_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_UTILS_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <string> | 11 #include <string> |
9 #include <vector> | 12 #include <vector> |
10 | 13 |
11 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
12 #include "base/strings/utf_offset_string_conversions.h" | 15 #include "base/strings/utf_offset_string_conversions.h" |
13 #include "components/bookmarks/browser/bookmark_node_data.h" | 16 #include "components/bookmarks/browser/bookmark_node_data.h" |
14 | 17 |
15 class GURL; | 18 class GURL; |
16 | 19 |
17 namespace user_prefs { | 20 namespace user_prefs { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Returns the parent for newly created folders/bookmarks. If |selection| has | 97 // Returns the parent for newly created folders/bookmarks. If |selection| has |
95 // one element and it is a folder, |selection[0]| is returned, otherwise | 98 // one element and it is a folder, |selection[0]| is returned, otherwise |
96 // |parent| is returned. If |index| is non-null it is set to the index newly | 99 // |parent| is returned. If |index| is non-null it is set to the index newly |
97 // added nodes should be added at. | 100 // added nodes should be added at. |
98 const BookmarkNode* GetParentForNewNodes( | 101 const BookmarkNode* GetParentForNewNodes( |
99 const BookmarkNode* parent, | 102 const BookmarkNode* parent, |
100 const std::vector<const BookmarkNode*>& selection, | 103 const std::vector<const BookmarkNode*>& selection, |
101 int* index); | 104 int* index); |
102 | 105 |
103 // Deletes the bookmark folders for the given list of |ids|. | 106 // Deletes the bookmark folders for the given list of |ids|. |
104 void DeleteBookmarkFolders(BookmarkModel* model, const std::vector<int64>& ids); | 107 void DeleteBookmarkFolders(BookmarkModel* model, |
| 108 const std::vector<int64_t>& ids); |
105 | 109 |
106 // If there are no user bookmarks for url, a bookmark is created. | 110 // If there are no user bookmarks for url, a bookmark is created. |
107 void AddIfNotBookmarked(BookmarkModel* model, | 111 void AddIfNotBookmarked(BookmarkModel* model, |
108 const GURL& url, | 112 const GURL& url, |
109 const base::string16& title); | 113 const base::string16& title); |
110 | 114 |
111 // Removes all bookmarks for the given |url|. | 115 // Removes all bookmarks for the given |url|. |
112 void RemoveAllBookmarks(BookmarkModel* model, const GURL& url); | 116 void RemoveAllBookmarks(BookmarkModel* model, const GURL& url); |
113 | 117 |
114 // Truncates an overly-long URL, unescapes it and interprets the characters | 118 // Truncates an overly-long URL, unescapes it and interprets the characters |
(...skipping 26 matching lines...) Expand all Loading... |
141 // Returns true if all the |nodes| can be edited by the user, | 145 // Returns true if all the |nodes| can be edited by the user, |
142 // as determined by BookmarkClient::CanBeEditedByUser(). | 146 // as determined by BookmarkClient::CanBeEditedByUser(). |
143 bool CanAllBeEditedByUser(BookmarkClient* client, | 147 bool CanAllBeEditedByUser(BookmarkClient* client, |
144 const std::vector<const BookmarkNode*>& nodes); | 148 const std::vector<const BookmarkNode*>& nodes); |
145 | 149 |
146 // Returns true if |url| has a bookmark in the |model| that can be edited | 150 // Returns true if |url| has a bookmark in the |model| that can be edited |
147 // by the user. | 151 // by the user. |
148 bool IsBookmarkedByUser(BookmarkModel* model, const GURL& url); | 152 bool IsBookmarkedByUser(BookmarkModel* model, const GURL& url); |
149 | 153 |
150 // Returns the node with |id|, or NULL if there is no node with |id|. | 154 // Returns the node with |id|, or NULL if there is no node with |id|. |
151 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id); | 155 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64_t id); |
152 | 156 |
153 // Returns true if |node| is a descendant of |root|. | 157 // Returns true if |node| is a descendant of |root|. |
154 bool IsDescendantOf(const BookmarkNode* node, const BookmarkNode* root); | 158 bool IsDescendantOf(const BookmarkNode* node, const BookmarkNode* root); |
155 | 159 |
156 // Returns true if any node in |list| is a descendant of |root|. | 160 // Returns true if any node in |list| is a descendant of |root|. |
157 bool HasDescendantsOf(const std::vector<const BookmarkNode*>& list, | 161 bool HasDescendantsOf(const std::vector<const BookmarkNode*>& list, |
158 const BookmarkNode* root); | 162 const BookmarkNode* root); |
159 | 163 |
160 } // namespace bookmarks | 164 } // namespace bookmarks |
161 | 165 |
162 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_UTILS_H_ | 166 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_UTILS_H_ |
OLD | NEW |