| 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 Profile; | |
| 12 | |
| 13 namespace bookmarks { | 11 namespace bookmarks { |
| 14 class BookmarkModel; | 12 class BookmarkModel; |
| 15 } | 13 } |
| 16 | 14 |
| 17 // This class implements history::HistoryClient to abstract operations that | 15 // This class implements history::HistoryClient to abstract operations that |
| 18 // depend on Chrome environment. | 16 // depend on Chrome environment. |
| 19 class ChromeHistoryClient : public history::HistoryClient { | 17 class ChromeHistoryClient : public history::HistoryClient { |
| 20 public: | 18 public: |
| 21 explicit ChromeHistoryClient(bookmarks::BookmarkModel* bookmark_model); | 19 explicit ChromeHistoryClient(bookmarks::BookmarkModel* bookmark_model); |
| 22 ~ChromeHistoryClient() override; | 20 ~ChromeHistoryClient() override; |
| 23 | 21 |
| 24 // history::HistoryClient: | 22 // history::HistoryClient implementation. |
| 25 void Shutdown() override; | 23 void Shutdown() override; |
| 26 void BlockUntilBookmarksLoaded() override; | |
| 27 bool IsBookmarked(const GURL& url) override; | |
| 28 void GetBookmarks(std::vector<history::URLAndTitle>* bookmarks) override; | |
| 29 bool CanAddURL(const GURL& url) override; | 24 bool CanAddURL(const GURL& url) override; |
| 30 void NotifyProfileError(sql::InitStatus init_status) override; | 25 void NotifyProfileError(sql::InitStatus init_status) override; |
| 31 bool ShouldReportDatabaseError() override; | 26 scoped_ptr<history::HistoryBackendClient> CreateBackendClient() override; |
| 32 #if defined(OS_ANDROID) | |
| 33 void OnHistoryBackendInitialized( | |
| 34 history::HistoryBackend* history_backend, | |
| 35 history::HistoryDatabase* history_database, | |
| 36 history::ThumbnailDatabase* thumbnail_database, | |
| 37 const base::FilePath& history_dir) override; | |
| 38 void OnHistoryBackendDestroyed(history::HistoryBackend* history_backend, | |
| 39 const base::FilePath& history_dir) override; | |
| 40 #endif | |
| 41 | 27 |
| 42 private: | 28 private: |
| 43 // The BookmarkModel, this should outlive ChromeHistoryClient. May be null | 29 // BookmarkModel instance providing access to bookmarks. May be null during |
| 44 // during testing. | 30 // testing but must outlive ChromeHistoryClient if non-null. |
| 45 bookmarks::BookmarkModel* bookmark_model_; | 31 bookmarks::BookmarkModel* bookmark_model_; |
| 46 | 32 |
| 47 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); | 33 DISALLOW_COPY_AND_ASSIGN(ChromeHistoryClient); |
| 48 }; | 34 }; |
| 49 | 35 |
| 50 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ | 36 #endif // CHROME_BROWSER_HISTORY_CHROME_HISTORY_CLIENT_H_ |
| OLD | NEW |