1 // Copyright (c) 2012 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 CHROME_BROWSER_BOOKMARKS_BOOKMARK_SERVICE_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_SERVICE_H_
10 #include "base/strings/string16.h"
17 // BookmarkService provides a thread safe view of bookmarks. It is used by
18 // HistoryBackend when it needs to determine the set of bookmarked URLs
19 // or if a URL is bookmarked.
21 // BookmarkService is owned by Profile and deleted when the Profile is deleted.
22 class BookmarkService
{
29 static BookmarkService
* FromBrowserContext(
30 content::BrowserContext
* browser_context
);
32 // Returns true if the specified URL is bookmarked.
34 // If not on the main thread you *must* invoke BlockTillLoaded first.
35 virtual bool IsBookmarked(const GURL
& url
) = 0;
37 // Returns, by reference in |bookmarks|, the set of bookmarked urls and their
38 // titles. This returns the unique set of URLs. For example, if two bookmarks
39 // reference the same URL only one entry is added not matter the titles are
42 // If not on the main thread you *must* invoke BlockTillLoaded first.
43 virtual void GetBookmarks(std::vector
<URLAndTitle
>* bookmarks
) = 0;
45 // Blocks until loaded. This is intended for usage on a thread other than
47 virtual void BlockTillLoaded() = 0;
50 virtual ~BookmarkService() {}
53 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_SERVICE_H_