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

Side by Side Diff: components/bookmarks/browser/bookmark_utils.h

Issue 1203713002: Limit access to ChromeBookmarkClient to bookmarks code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_bookmark_client
Patch Set: Rebase Created 5 years, 5 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 unified diff | Download patch
OLDNEW
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/utf_offset_string_conversions.h" 12 #include "base/strings/utf_offset_string_conversions.h"
13 #include "components/bookmarks/browser/bookmark_node_data.h" 13 #include "components/bookmarks/browser/bookmark_node_data.h"
14 14
15 class GURL; 15 class GURL;
16 16
17 namespace user_prefs { 17 namespace user_prefs {
18 class PrefRegistrySyncable; 18 class PrefRegistrySyncable;
19 } 19 }
20 20
21 // A collection of bookmark utility functions used by various parts of the UI 21 // A collection of bookmark utility functions used by various parts of the UI
22 // that show bookmarks (bookmark manager, bookmark bar view, ...) and other 22 // that show bookmarks (bookmark manager, bookmark bar view, ...) and other
23 // systems that involve indexing and searching bookmarks. 23 // systems that involve indexing and searching bookmarks.
24 namespace bookmarks { 24 namespace bookmarks {
25 25
26 class BookmarkClient;
27 class BookmarkModel; 26 class BookmarkModel;
28 class BookmarkNode; 27 class BookmarkNode;
29 28
30 // Fields to use when finding matching bookmarks. 29 // Fields to use when finding matching bookmarks.
31 struct QueryFields { 30 struct QueryFields {
32 QueryFields(); 31 QueryFields();
33 ~QueryFields(); 32 ~QueryFields();
34 33
35 scoped_ptr<base::string16> word_phrase_query; 34 scoped_ptr<base::string16> word_phrase_query;
36 scoped_ptr<base::string16> url; 35 scoped_ptr<base::string16> url;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 base::string16 CleanUpUrlForMatching( 131 base::string16 CleanUpUrlForMatching(
133 const GURL& gurl, 132 const GURL& gurl,
134 const std::string& languages, 133 const std::string& languages,
135 base::OffsetAdjuster::Adjustments* adjustments); 134 base::OffsetAdjuster::Adjustments* adjustments);
136 135
137 // Returns the lower-cased title, possibly truncated if the original title 136 // Returns the lower-cased title, possibly truncated if the original title
138 // is overly-long. 137 // is overly-long.
139 base::string16 CleanUpTitleForMatching(const base::string16& title); 138 base::string16 CleanUpTitleForMatching(const base::string16& title);
140 139
141 // Returns true if all the |nodes| can be edited by the user, 140 // Returns true if all the |nodes| can be edited by the user,
142 // as determined by BookmarkClient::CanBeEditedByUser(). 141 // as determined by BookmarkModel::CanBeEditedByUser().
143 bool CanAllBeEditedByUser(BookmarkClient* client, 142 bool CanAllBeEditedByUser(BookmarkModel* model,
144 const std::vector<const BookmarkNode*>& nodes); 143 const std::vector<const BookmarkNode*>& nodes);
145 144
146 // Returns true if |url| has a bookmark in the |model| that can be edited 145 // Returns true if |url| has a bookmark in the |model| that can be edited
147 // by the user. 146 // by the user.
148 bool IsBookmarkedByUser(BookmarkModel* model, const GURL& url); 147 bool IsBookmarkedByUser(BookmarkModel* model, const GURL& url);
149 148
150 // Returns the node with |id|, or NULL if there is no node with |id|. 149 // Returns the node with |id|, or NULL if there is no node with |id|.
151 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id); 150 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id);
152 151
153 // Returns true if |node| is a descendant of |root|. 152 // Returns true if |node| is a descendant of |root|.
154 bool IsDescendantOf(const BookmarkNode* node, const BookmarkNode* root); 153 bool IsDescendantOf(const BookmarkNode* node, const BookmarkNode* root);
155 154
156 // Returns true if any node in |list| is a descendant of |root|. 155 // Returns true if any node in |list| is a descendant of |root|.
157 bool HasDescendantsOf(const std::vector<const BookmarkNode*>& list, 156 bool HasDescendantsOf(const std::vector<const BookmarkNode*>& list,
158 const BookmarkNode* root); 157 const BookmarkNode* root);
159 158
160 } // namespace bookmarks 159 } // namespace bookmarks
161 160
162 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_UTILS_H_ 161 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698