OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_SERVICE_H_ | |
6 #define COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_SERVICE_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/strings/string16.h" | |
11 #include "url/gurl.h" | |
12 | |
13 // BookmarkService provides a thread safe view of bookmarks. It can be used | |
14 // to determine the set of bookmarked URLs or to check if an URL is bookmarked. | |
15 class BookmarkService { | |
16 public: | |
17 struct URLAndTitle { | |
18 GURL url; | |
19 base::string16 title; | |
20 }; | |
21 | |
22 // Returns true if the specified URL is bookmarked. | |
23 // | |
24 // If not on the main thread you *must* invoke BlockTillLoaded first. | |
25 virtual bool IsBookmarked(const GURL& url) = 0; | |
26 | |
27 // Returns, by reference in |bookmarks|, the set of bookmarked urls and their | |
28 // titles. This returns the unique set of URLs. For example, if two bookmarks | |
29 // reference the same URL only one entry is added not matter the titles are | |
30 // same or not. | |
31 // | |
32 // If not on the main thread you *must* invoke BlockTillLoaded first. | |
33 virtual void GetBookmarks(std::vector<URLAndTitle>* bookmarks) = 0; | |
34 | |
35 // Blocks until loaded. This is intended for usage on a thread other than | |
36 // the main thread. | |
37 virtual void BlockTillLoaded() = 0; | |
38 | |
39 protected: | |
40 virtual ~BookmarkService() {} | |
41 }; | |
42 | |
43 #endif // COMPONENTS_BOOKMARKS_CORE_BROWSER_BOOKMARK_SERVICE_H_ | |
OLD | NEW |