| Index: components/history/core/browser/history_backend.cc
|
| diff --git a/components/history/core/browser/history_backend.cc b/components/history/core/browser/history_backend.cc
|
| index b75252bffa5ab84f3fa17b03c098875c28392377..fc347ba575960fd123c8720cf5e8ce7d2225780c 100644
|
| --- a/components/history/core/browser/history_backend.cc
|
| +++ b/components/history/core/browser/history_backend.cc
|
| @@ -27,8 +27,8 @@
|
| #include "components/favicon_base/select_favicon_frames.h"
|
| #include "components/history/core/browser/download_constants.h"
|
| #include "components/history/core/browser/download_row.h"
|
| +#include "components/history/core/browser/history_backend_client.h"
|
| #include "components/history/core/browser/history_backend_observer.h"
|
| -#include "components/history/core/browser/history_client.h"
|
| #include "components/history/core/browser/history_constants.h"
|
| #include "components/history/core/browser/history_database.h"
|
| #include "components/history/core/browser/history_database_params.h"
|
| @@ -199,15 +199,15 @@ HistoryBackendHelper::~HistoryBackendHelper() {
|
|
|
| HistoryBackend::HistoryBackend(
|
| Delegate* delegate,
|
| - HistoryClient* history_client,
|
| + scoped_ptr<HistoryBackendClient> backend_client,
|
| scoped_refptr<base::SequencedTaskRunner> task_runner)
|
| : delegate_(delegate),
|
| scheduled_kill_db_(false),
|
| - expirer_(this, history_client, task_runner),
|
| + expirer_(this, backend_client.get(), task_runner),
|
| recent_redirects_(kMaxRedirectCount),
|
| backend_destroy_message_loop_(nullptr),
|
| segment_queried_(false),
|
| - history_client_(history_client),
|
| + backend_client_(backend_client.Pass()),
|
| task_runner_(task_runner) {
|
| }
|
|
|
| @@ -229,8 +229,10 @@ HistoryBackend::~HistoryBackend() {
|
| backend_destroy_message_loop_->PostTask(FROM_HERE, backend_destroy_task_);
|
| }
|
|
|
| - if (history_client_ && !history_dir_.empty())
|
| - history_client_->OnHistoryBackendDestroyed(this, history_dir_);
|
| +#if defined(OS_ANDROID)
|
| + if (backend_client_ && !history_dir_.empty())
|
| + backend_client_->OnHistoryBackendDestroyed(this, history_dir_);
|
| +#endif
|
| }
|
|
|
| void HistoryBackend::Init(
|
| @@ -657,7 +659,7 @@ void HistoryBackend::InitImpl(
|
| // favicons. Thumbnails are stored in "top sites". Consider
|
| // renaming "thumbnail" references to "favicons" or something of the
|
| // sort.
|
| - thumbnail_db_.reset(new ThumbnailDatabase(history_client_));
|
| + thumbnail_db_.reset(new ThumbnailDatabase(backend_client_.get()));
|
| if (thumbnail_db_->Init(thumbnail_name) != sql::INIT_OK) {
|
| // Unlike the main database, we don't error out when the database is too
|
| // new because this error is much less severe. Generally, this shouldn't
|
| @@ -696,10 +698,12 @@ void HistoryBackend::InitImpl(
|
| // Start expiring old stuff.
|
| expirer_.StartExpiringOldStuff(TimeDelta::FromDays(kExpireDaysThreshold));
|
|
|
| - if (history_client_) {
|
| - history_client_->OnHistoryBackendInitialized(
|
| +#if defined(OS_ANDROID)
|
| + if (backend_client_) {
|
| + backend_client_->OnHistoryBackendInitialized(
|
| this, db_.get(), thumbnail_db_.get(), history_dir_);
|
| }
|
| +#endif
|
|
|
| LOCAL_HISTOGRAM_TIMES("History.InitTime", TimeTicks::Now() - beginning_time);
|
| }
|
| @@ -1814,7 +1818,6 @@ void HistoryBackend::SetImportedFavicons(
|
| }
|
|
|
| // Save the mapping from all the URLs to the favicon.
|
| - HistoryClient* history_client = GetHistoryClient();
|
| for (std::set<GURL>::const_iterator url = favicon_usage[i].urls.begin();
|
| url != favicon_usage[i].urls.end(); ++url) {
|
| URLRow url_row;
|
| @@ -1824,7 +1827,7 @@ void HistoryBackend::SetImportedFavicons(
|
| // for regular bookmarked URLs with favicons - when history db is
|
| // cleaned, we keep an entry in the db with 0 visits as long as that
|
| // url is bookmarked.
|
| - if (history_client && history_client->IsBookmarked(*url)) {
|
| + if (backend_client_ && backend_client_->IsBookmarked(*url)) {
|
| URLRow url_info(*url);
|
| url_info.set_visit_count(0);
|
| url_info.set_typed_count(0);
|
| @@ -2558,9 +2561,8 @@ void HistoryBackend::DeleteAllHistory() {
|
|
|
| // Get the bookmarked URLs.
|
| std::vector<URLAndTitle> starred_url_and_titles;
|
| - HistoryClient* history_client = GetHistoryClient();
|
| - if (history_client)
|
| - history_client->GetBookmarks(&starred_url_and_titles);
|
| + if (backend_client_)
|
| + backend_client_->GetBookmarks(&starred_url_and_titles);
|
|
|
| URLRows kept_url_rows;
|
| std::vector<GURL> starred_urls;
|
| @@ -2670,10 +2672,4 @@ bool HistoryBackend::ClearAllMainHistory(const URLRows& kept_urls) {
|
| return true;
|
| }
|
|
|
| -HistoryClient* HistoryBackend::GetHistoryClient() {
|
| - if (history_client_)
|
| - history_client_->BlockUntilBookmarksLoaded();
|
| - return history_client_;
|
| -}
|
| -
|
| } // namespace history
|
|
|