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