| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "ios/chrome/browser/autocomplete/in_memory_url_index_factory.h" | 5 #include "ios/chrome/browser/autocomplete/in_memory_url_index_factory.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 8 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 9 #include "components/keyed_service/core/service_access_type.h" | 11 #include "components/keyed_service/core/service_access_type.h" |
| 10 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 12 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
| 11 #include "components/omnibox/browser/in_memory_url_index.h" | 13 #include "components/omnibox/browser/in_memory_url_index.h" |
| 12 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
| 13 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" | 15 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" |
| 14 #include "ios/chrome/browser/chrome_url_constants.h" | 16 #include "ios/chrome/browser/chrome_url_constants.h" |
| 15 #include "ios/chrome/browser/history/history_service_factory.h" | 17 #include "ios/chrome/browser/history/history_service_factory.h" |
| 16 #include "ios/chrome/browser/pref_names.h" | 18 #include "ios/chrome/browser/pref_names.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 // Do not force creation of the HistoryService if saving history is disabled. | 34 // Do not force creation of the HistoryService if saving history is disabled. |
| 33 scoped_ptr<InMemoryURLIndex> in_memory_url_index(new InMemoryURLIndex( | 35 scoped_ptr<InMemoryURLIndex> in_memory_url_index(new InMemoryURLIndex( |
| 34 ios::BookmarkModelFactory::GetForBrowserState(browser_state), | 36 ios::BookmarkModelFactory::GetForBrowserState(browser_state), |
| 35 ios::HistoryServiceFactory::GetForBrowserState( | 37 ios::HistoryServiceFactory::GetForBrowserState( |
| 36 browser_state, ServiceAccessType::IMPLICIT_ACCESS), | 38 browser_state, ServiceAccessType::IMPLICIT_ACCESS), |
| 37 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state), | 39 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state), |
| 38 web::WebThread::GetBlockingPool(), browser_state->GetStatePath(), | 40 web::WebThread::GetBlockingPool(), browser_state->GetStatePath(), |
| 39 browser_state->GetPrefs()->GetString(prefs::kAcceptLanguages), | 41 browser_state->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 40 schemes_to_whilelist)); | 42 schemes_to_whilelist)); |
| 41 in_memory_url_index->Init(); | 43 in_memory_url_index->Init(); |
| 42 return in_memory_url_index.Pass(); | 44 return std::move(in_memory_url_index); |
| 43 } | 45 } |
| 44 | 46 |
| 45 } // namespace | 47 } // namespace |
| 46 | 48 |
| 47 // static | 49 // static |
| 48 InMemoryURLIndex* InMemoryURLIndexFactory::GetForBrowserState( | 50 InMemoryURLIndex* InMemoryURLIndexFactory::GetForBrowserState( |
| 49 ios::ChromeBrowserState* browser_state) { | 51 ios::ChromeBrowserState* browser_state) { |
| 50 return static_cast<InMemoryURLIndex*>( | 52 return static_cast<InMemoryURLIndex*>( |
| 51 GetInstance()->GetServiceForBrowserState(browser_state, true)); | 53 GetInstance()->GetServiceForBrowserState(browser_state, true)); |
| 52 } | 54 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 81 web::BrowserState* InMemoryURLIndexFactory::GetBrowserStateToUse( | 83 web::BrowserState* InMemoryURLIndexFactory::GetBrowserStateToUse( |
| 82 web::BrowserState* context) const { | 84 web::BrowserState* context) const { |
| 83 return GetBrowserStateRedirectedInIncognito(context); | 85 return GetBrowserStateRedirectedInIncognito(context); |
| 84 } | 86 } |
| 85 | 87 |
| 86 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const { | 88 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const { |
| 87 return true; | 89 return true; |
| 88 } | 90 } |
| 89 | 91 |
| 90 } // namespace ios | 92 } // namespace ios |
| OLD | NEW |