OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_ | 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_ |
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_ | 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" |
9 #include "components/keyed_service/core/keyed_service.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
| 13 #include "url/gurl.h" |
10 | 14 |
11 namespace history { | 15 namespace history { |
12 | 16 |
| 17 struct URLAndTitle { |
| 18 GURL url; |
| 19 base::string16 title; |
| 20 }; |
| 21 |
13 // This class abstracts operations that depend on the embedder's environment, | 22 // This class abstracts operations that depend on the embedder's environment, |
14 // e.g. Chrome. | 23 // e.g. Chrome. |
15 class HistoryClient : public KeyedService { | 24 class HistoryClient : public KeyedService { |
| 25 public: |
| 26 HistoryClient(); |
| 27 |
| 28 // Waits until the bookmarks have been loaded. |
| 29 // |
| 30 // Must not be called from the main thread. |
| 31 virtual void BlockUntilBookmarksLoaded(); |
| 32 |
| 33 // Returns true if the specified URL is bookmarked. |
| 34 // |
| 35 // If not on the main thread, then BlockUntilBookmarksLoaded must be called. |
| 36 virtual bool IsBookmarked(const GURL& url); |
| 37 |
| 38 // Returns, by reference in |bookmarks|, the set of bookmarked urls and their |
| 39 // titles. This returns the unique set of URLs. For example, if two bookmarks |
| 40 // reference the same URL only one entry is added even if the title are not |
| 41 // the same. |
| 42 // |
| 43 // If not on the main thread, then BlockUntilBookmarksLoaded must be called. |
| 44 virtual void GetBookmarks(std::vector<URLAndTitle>* bookmarks); |
| 45 |
16 protected: | 46 protected: |
17 HistoryClient() {} | |
18 | |
19 DISALLOW_COPY_AND_ASSIGN(HistoryClient); | 47 DISALLOW_COPY_AND_ASSIGN(HistoryClient); |
20 }; | 48 }; |
21 | 49 |
22 } // namespace history | 50 } // namespace history |
23 | 51 |
24 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_ | 52 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_CLIENT_H_ |
OLD | NEW |