Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: ios/chrome/browser/autocomplete/in_memory_url_index_factory.cc

Issue 1861593005: Convert //ios from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add header Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 7 #include <utility>
8 8
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "components/keyed_service/core/service_access_type.h" 10 #include "components/keyed_service/core/service_access_type.h"
11 #include "components/keyed_service/ios/browser_state_dependency_manager.h" 11 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
12 #include "components/omnibox/browser/in_memory_url_index.h" 12 #include "components/omnibox/browser/in_memory_url_index.h"
13 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" 13 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
14 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" 14 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
16 #include "ios/chrome/browser/chrome_url_constants.h" 16 #include "ios/chrome/browser/chrome_url_constants.h"
17 #include "ios/chrome/browser/history/history_service_factory.h" 17 #include "ios/chrome/browser/history/history_service_factory.h"
18 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" 18 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
19 #include "ios/web/public/web_thread.h" 19 #include "ios/web/public/web_thread.h"
20 20
21 namespace ios { 21 namespace ios {
22 22
23 namespace { 23 namespace {
24 24
25 scoped_ptr<KeyedService> BuildInMemoryURLIndex(web::BrowserState* context) { 25 std::unique_ptr<KeyedService> BuildInMemoryURLIndex(
26 web::BrowserState* context) {
26 ios::ChromeBrowserState* browser_state = 27 ios::ChromeBrowserState* browser_state =
27 ios::ChromeBrowserState::FromBrowserState(context); 28 ios::ChromeBrowserState::FromBrowserState(context);
28 29
29 SchemeSet schemes_to_whilelist; 30 SchemeSet schemes_to_whilelist;
30 schemes_to_whilelist.insert(kChromeUIScheme); 31 schemes_to_whilelist.insert(kChromeUIScheme);
31 32
32 // Do not force creation of the HistoryService if saving history is disabled. 33 // Do not force creation of the HistoryService if saving history is disabled.
33 scoped_ptr<InMemoryURLIndex> in_memory_url_index(new InMemoryURLIndex( 34 std::unique_ptr<InMemoryURLIndex> in_memory_url_index(new InMemoryURLIndex(
34 ios::BookmarkModelFactory::GetForBrowserState(browser_state), 35 ios::BookmarkModelFactory::GetForBrowserState(browser_state),
35 ios::HistoryServiceFactory::GetForBrowserState( 36 ios::HistoryServiceFactory::GetForBrowserState(
36 browser_state, ServiceAccessType::IMPLICIT_ACCESS), 37 browser_state, ServiceAccessType::IMPLICIT_ACCESS),
37 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state), 38 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state),
38 web::WebThread::GetBlockingPool(), browser_state->GetStatePath(), 39 web::WebThread::GetBlockingPool(), browser_state->GetStatePath(),
39 schemes_to_whilelist)); 40 schemes_to_whilelist));
40 in_memory_url_index->Init(); 41 in_memory_url_index->Init();
41 return std::move(in_memory_url_index); 42 return std::move(in_memory_url_index);
42 } 43 }
43 44
(...skipping 21 matching lines...) Expand all
65 } 66 }
66 67
67 InMemoryURLIndexFactory::~InMemoryURLIndexFactory() {} 68 InMemoryURLIndexFactory::~InMemoryURLIndexFactory() {}
68 69
69 // static 70 // static
70 BrowserStateKeyedServiceFactory::TestingFactoryFunction 71 BrowserStateKeyedServiceFactory::TestingFactoryFunction
71 InMemoryURLIndexFactory::GetDefaultFactory() { 72 InMemoryURLIndexFactory::GetDefaultFactory() {
72 return &BuildInMemoryURLIndex; 73 return &BuildInMemoryURLIndex;
73 } 74 }
74 75
75 scoped_ptr<KeyedService> InMemoryURLIndexFactory::BuildServiceInstanceFor( 76 std::unique_ptr<KeyedService> InMemoryURLIndexFactory::BuildServiceInstanceFor(
76 web::BrowserState* context) const { 77 web::BrowserState* context) const {
77 return BuildInMemoryURLIndex(context); 78 return BuildInMemoryURLIndex(context);
78 } 79 }
79 80
80 web::BrowserState* InMemoryURLIndexFactory::GetBrowserStateToUse( 81 web::BrowserState* InMemoryURLIndexFactory::GetBrowserStateToUse(
81 web::BrowserState* context) const { 82 web::BrowserState* context) const {
82 return GetBrowserStateRedirectedInIncognito(context); 83 return GetBrowserStateRedirectedInIncognito(context);
83 } 84 }
84 85
85 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const { 86 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const {
86 return true; 87 return true;
87 } 88 }
88 89
89 } // namespace ios 90 } // namespace ios
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698