Chromium Code Reviews| 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..ce621c2f2622b530a80ce0a7922f8a18e0dc4937 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,28 @@ |
| 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(); |
| +} |
| +} |
|
sdefresne
2015/11/05 14:58:59
You need "// namespace" and I'd prefer if you eith
|
| + |
| // static |
| InMemoryURLIndex* InMemoryURLIndexFactory::GetForBrowserState( |
| ios::ChromeBrowserState* browser_state) { |
| @@ -41,24 +63,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( |