| 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 CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ |
| 6 #define CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ | 6 #define CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/history/core/browser/history_client.h" | 9 #include "components/history/core/browser/history_client.h" |
| 10 | 10 |
| 11 class HistoryService; | 11 class HistoryService; |
| 12 class Profile; | 12 class Profile; |
| 13 | 13 |
| 14 namespace bookmarks { | 14 namespace bookmarks { |
| 15 class BookmarkModel; | 15 class BookmarkModel; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // This class implements history::HistoryClient to abstract operations that | 18 // This class implements history::HistoryClient to abstract operations that |
| 19 // depend on Chrome environment. | 19 // depend on Chrome environment. |
| 20 class ChromeHistoryClient : public history::HistoryClient { | 20 class ChromeHistoryClient : public history::HistoryClient { |
| 21 public: | 21 public: |
| 22 explicit ChromeHistoryClient(bookmarks::BookmarkModel* bookmark_model); | 22 explicit ChromeHistoryClient(bookmarks::BookmarkModel* bookmark_model); |
| 23 ~ChromeHistoryClient() override; | 23 ~ChromeHistoryClient() override; |
| 24 | 24 |
| 25 // history::HistoryClient: | 25 // history::HistoryClient: |
| 26 void BlockUntilBookmarksLoaded() override; | 26 void BlockUntilBookmarksLoaded() override; |
| 27 bool IsBookmarked(const GURL& url) override; | 27 bool IsBookmarked(const GURL& url) override; |
| 28 void GetBookmarks(std::vector<history::URLAndTitle>* bookmarks) override; | 28 void GetBookmarks(std::vector<history::URLAndTitle>* bookmarks) override; |
| 29 bool CanAddURL(const GURL& url) override; |
| 29 void NotifyProfileError(sql::InitStatus init_status) override; | 30 void NotifyProfileError(sql::InitStatus init_status) override; |
| 30 bool ShouldReportDatabaseError() override; | 31 bool ShouldReportDatabaseError() override; |
| 31 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
| 32 void OnHistoryBackendInitialized( | 33 void OnHistoryBackendInitialized( |
| 33 history::HistoryBackend* history_backend, | 34 history::HistoryBackend* history_backend, |
| 34 history::HistoryDatabase* history_database, | 35 history::HistoryDatabase* history_database, |
| 35 history::ThumbnailDatabase* thumbnail_database, | 36 history::ThumbnailDatabase* thumbnail_database, |
| 36 const base::FilePath& history_dir) override; | 37 const base::FilePath& history_dir) override; |
| 37 void OnHistoryBackendDestroyed(history::HistoryBackend* history_backend, | 38 void OnHistoryBackendDestroyed(history::HistoryBackend* history_backend, |
| 38 const base::FilePath& history_dir) override; | 39 const base::FilePath& history_dir) override; |
| 39 #endif | 40 #endif |
| 40 | 41 |
| 41 // KeyedService: | 42 // KeyedService: |
| 42 void Shutdown() override; | 43 void Shutdown() override; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 // The BookmarkModel, this should outlive ChromeHistoryClient. | 46 // The BookmarkModel, this should outlive ChromeHistoryClient. |
| 46 bookmarks::BookmarkModel* bookmark_model_; | 47 bookmarks::BookmarkModel* bookmark_model_; |
| 47 | 48 |
| 48 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); | 49 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ | 52 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ |
| OLD | NEW |