| Index: chrome/browser/history/history_service.cc
|
| diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
|
| index e46633d9b321f225dc368ce6b48bb3d81d107d73..ce1543a077d7ac76edccfec24bb34a781f14719d 100644
|
| --- a/chrome/browser/history/history_service.cc
|
| +++ b/chrome/browser/history/history_service.cc
|
| @@ -25,7 +25,6 @@
|
| #include "base/location.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/message_loop/message_loop.h"
|
| -#include "base/prefs/pref_service.h"
|
| #include "base/thread_task_runner_handle.h"
|
| #include "base/threading/thread.h"
|
| #include "base/time/time.h"
|
| @@ -39,7 +38,6 @@
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/importer/imported_favicon_usage.h"
|
| -#include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "components/dom_distiller/core/url_constants.h"
|
| #include "components/history/core/browser/download_row.h"
|
| @@ -228,16 +226,16 @@ HistoryService::HistoryService()
|
| weak_ptr_factory_(this) {
|
| }
|
|
|
| -HistoryService::HistoryService(history::HistoryClient* client, Profile* profile)
|
| +HistoryService::HistoryService(
|
| + history::HistoryClient* history_client, Profile* profile)
|
| : thread_(new base::Thread(kHistoryThreadName)),
|
| - history_client_(client),
|
| + history_client_(history_client),
|
| profile_(profile),
|
| visitedlink_master_(new visitedlink::VisitedLinkMaster(
|
| profile, this, true)),
|
| backend_loaded_(false),
|
| no_db_(false),
|
| weak_ptr_factory_(this) {
|
| - DCHECK(profile_);
|
| }
|
|
|
| HistoryService::~HistoryService() {
|
| @@ -968,6 +966,7 @@ void HistoryService::RebuildTable(
|
|
|
| bool HistoryService::Init(
|
| bool no_db,
|
| + const std::string& languages,
|
| const history::HistoryDatabaseParams& history_database_params) {
|
| DCHECK(thread_) << "History service being called after cleanup";
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| @@ -981,9 +980,9 @@ bool HistoryService::Init(
|
| history_dir_ = history_database_params.history_dir;
|
| no_db_ = no_db;
|
|
|
| - if (profile_) {
|
| - std::string languages =
|
| - profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
|
| + if (!languages.empty()) {
|
| + // During unit testing, there may not be a PrefService, and thus
|
| + // |languages| is empty.
|
| in_memory_url_index_.reset(new history::InMemoryURLIndex(
|
| this, history_dir_, languages, history_client_));
|
| in_memory_url_index_->Init();
|
| @@ -996,13 +995,6 @@ bool HistoryService::Init(
|
| history_client_));
|
| history_backend_.swap(backend);
|
|
|
| - // There may not be a profile when unit testing.
|
| - std::string languages;
|
| - if (profile_) {
|
| - PrefService* prefs = profile_->GetPrefs();
|
| - languages = prefs->GetString(prefs::kAcceptLanguages);
|
| - }
|
| -
|
| ScheduleTask(PRIORITY_UI,
|
| base::Bind(&HistoryBackend::Init, history_backend_.get(),
|
| languages, no_db_, history_database_params));
|
|
|