Roll ANGLE.
[chromium-blink-merge.git] / components / bookmarks / browser / bookmark_service.h
blob22c5568f045be00ff32f1ef8110976eda35d3f0b
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.
5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_SERVICE_H_
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_SERVICE_H_
8 #include <vector>
10 #include "base/strings/string16.h"
11 #include "url/gurl.h"
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;
22 // Returns true if the specified URL is bookmarked.
24 // If not on the main thread you *must* invoke BlockTillLoaded first.
25 virtual bool IsBookmarked(const GURL& url) = 0;
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.
32 // If not on the main thread you *must* invoke BlockTillLoaded first.
33 virtual void GetBookmarks(std::vector<URLAndTitle>* bookmarks) = 0;
35 // Blocks until loaded. This is intended for usage on a thread other than
36 // the main thread.
37 virtual void BlockTillLoaded() = 0;
39 protected:
40 virtual ~BookmarkService() {}
43 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_SERVICE_H_