Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / bookmarks / bookmark_service.h
blobf3f5fe11bb643bb8e8c3aa1038685e0cbd0b756b
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_
8 #include <vector>
10 #include "base/strings/string16.h"
11 #include "url/gurl.h"
13 namespace content {
14 class BrowserContext;
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 {
23 public:
24 struct URLAndTitle {
25 GURL url;
26 base::string16 title;
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
40 // same or not.
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
46 // the main thread.
47 virtual void BlockTillLoaded() = 0;
49 protected:
50 virtual ~BookmarkService() {}
53 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_SERVICE_H_