1// Copyright (c) 2010 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 CHROME_BROWSER_BOOKMARKS_BOOKMARK_SERVICE_H_ 6#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_SERVICE_H_ 7#pragma once 8 9#include <vector> 10 11class GURL; 12 13// BookmarkService provides a thread safe view of bookmarks. It is used by 14// HistoryBackend when it needs to determine the set of bookmarked URLs 15// or if a URL is bookmarked. 16// 17// BookmarkService is owned by Profile and deleted when the Profile is deleted. 18class BookmarkService { 19 public: 20 // Returns true if the specified URL is bookmarked. 21 // 22 // If not on the main thread you *must* invoke BlockTillLoaded first. 23 virtual bool IsBookmarked(const GURL& url) = 0; 24 25 // Returns, by reference in urls, the set of bookmarked urls. This returns 26 // the unique set of URLs. For example, if two bookmarks reference the same 27 // URL only one entry is added. 28 // 29 // If not on the main thread you *must* invoke BlockTillLoaded first. 30 virtual void GetBookmarks(std::vector<GURL>* urls) = 0; 31 32 // Blocks until loaded. This is intended for usage on a thread other than 33 // the main thread. 34 virtual void BlockTillLoaded() = 0; 35 36 protected: 37 virtual ~BookmarkService() {} 38}; 39 40#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_SERVICE_H_ 41