| Index: ios/chrome/browser/autocomplete/in_memory_url_index_factory.cc
|
| diff --git a/ios/chrome/browser/autocomplete/in_memory_url_index_factory.cc b/ios/chrome/browser/autocomplete/in_memory_url_index_factory.cc
|
| index da2d26b67b0babce099bc63b35f5acfc049a6c27..232f9d064e9f74d1fc6ab5d14800ea4eab7d308a 100644
|
| --- a/ios/chrome/browser/autocomplete/in_memory_url_index_factory.cc
|
| +++ b/ios/chrome/browser/autocomplete/in_memory_url_index_factory.cc
|
| @@ -19,6 +19,29 @@
|
|
|
| namespace ios {
|
|
|
| +namespace {
|
| +
|
| +scoped_ptr<KeyedService> BuildInMemoryURLIndex(web::BrowserState* context) {
|
| + ios::ChromeBrowserState* browser_state =
|
| + ios::ChromeBrowserState::FromBrowserState(context);
|
| +
|
| + SchemeSet schemes_to_whilelist;
|
| + schemes_to_whilelist.insert(kChromeUIScheme);
|
| +
|
| + // Do not force creation of the HistoryService if saving history is disabled.
|
| + scoped_ptr<InMemoryURLIndex> in_memory_url_index(new InMemoryURLIndex(
|
| + ios::BookmarkModelFactory::GetForBrowserState(browser_state),
|
| + ios::HistoryServiceFactory::GetForBrowserState(
|
| + browser_state, ServiceAccessType::IMPLICIT_ACCESS),
|
| + web::WebThread::GetBlockingPool(), browser_state->GetStatePath(),
|
| + browser_state->GetPrefs()->GetString(ios::prefs::kAcceptLanguages),
|
| + schemes_to_whilelist));
|
| + in_memory_url_index->Init();
|
| + return in_memory_url_index.Pass();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| // static
|
| InMemoryURLIndex* InMemoryURLIndexFactory::GetForBrowserState(
|
| ios::ChromeBrowserState* browser_state) {
|
| @@ -41,24 +64,15 @@ InMemoryURLIndexFactory::InMemoryURLIndexFactory()
|
|
|
| InMemoryURLIndexFactory::~InMemoryURLIndexFactory() {}
|
|
|
| +// static
|
| +BrowserStateKeyedServiceFactory::TestingFactoryFunction
|
| +InMemoryURLIndexFactory::GetDefaultFactory() {
|
| + return &BuildInMemoryURLIndex;
|
| +}
|
| +
|
| scoped_ptr<KeyedService> InMemoryURLIndexFactory::BuildServiceInstanceFor(
|
| web::BrowserState* context) const {
|
| - ios::ChromeBrowserState* browser_state =
|
| - ios::ChromeBrowserState::FromBrowserState(context);
|
| -
|
| - SchemeSet schemes_to_whilelist;
|
| - schemes_to_whilelist.insert(kChromeUIScheme);
|
| -
|
| - // Do not force creation of the HistoryService if saving history is disabled.
|
| - scoped_ptr<InMemoryURLIndex> in_memory_url_index(new InMemoryURLIndex(
|
| - ios::BookmarkModelFactory::GetForBrowserState(browser_state),
|
| - ios::HistoryServiceFactory::GetForBrowserState(
|
| - browser_state, ServiceAccessType::IMPLICIT_ACCESS),
|
| - web::WebThread::GetBlockingPool(), browser_state->GetStatePath(),
|
| - browser_state->GetPrefs()->GetString(ios::prefs::kAcceptLanguages),
|
| - schemes_to_whilelist));
|
| - in_memory_url_index->Init();
|
| - return in_memory_url_index.Pass();
|
| + return BuildInMemoryURLIndex(context);
|
| }
|
|
|
| web::BrowserState* InMemoryURLIndexFactory::GetBrowserStateToUse(
|
|
|