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

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

Issue 2216713002: Use BookmarkModelFactory::GetForBrowserContext everywhere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bookmarks
Patch Set: Eliminate Profile::FromBrowserContext in some places Created 4 years, 4 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 "chrome/browser/autocomplete/in_memory_url_index_factory.h" 5 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #include "chrome/browser/history/history_service_factory.h" 9 #include "chrome/browser/history/history_service_factory.h"
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
(...skipping 27 matching lines...) Expand all
38 38
39 InMemoryURLIndexFactory::~InMemoryURLIndexFactory() { 39 InMemoryURLIndexFactory::~InMemoryURLIndexFactory() {
40 } 40 }
41 41
42 KeyedService* InMemoryURLIndexFactory::BuildServiceInstanceFor( 42 KeyedService* InMemoryURLIndexFactory::BuildServiceInstanceFor(
43 content::BrowserContext* context) const { 43 content::BrowserContext* context) const {
44 // Do not force creation of the HistoryService if saving history is disabled. 44 // Do not force creation of the HistoryService if saving history is disabled.
45 Profile* profile = Profile::FromBrowserContext(context); 45 Profile* profile = Profile::FromBrowserContext(context);
46 SchemeSet chrome_schemes_to_whitelist; 46 SchemeSet chrome_schemes_to_whitelist;
47 chrome_schemes_to_whitelist.insert(content::kChromeUIScheme); 47 chrome_schemes_to_whitelist.insert(content::kChromeUIScheme);
48 InMemoryURLIndex* in_memory_url_index = new InMemoryURLIndex( 48 InMemoryURLIndex* in_memory_url_index =
49 BookmarkModelFactory::GetForProfile(profile), 49 new InMemoryURLIndex(BookmarkModelFactory::GetForBrowserContext(profile),
50 HistoryServiceFactory::GetForProfile(profile, 50 HistoryServiceFactory::GetForProfile(
51 ServiceAccessType::IMPLICIT_ACCESS), 51 profile, ServiceAccessType::IMPLICIT_ACCESS),
52 TemplateURLServiceFactory::GetForProfile(profile), 52 TemplateURLServiceFactory::GetForProfile(profile),
53 content::BrowserThread::GetBlockingPool(), profile->GetPath(), 53 content::BrowserThread::GetBlockingPool(),
54 chrome_schemes_to_whitelist); 54 profile->GetPath(), chrome_schemes_to_whitelist);
55 in_memory_url_index->Init(); 55 in_memory_url_index->Init();
56 return in_memory_url_index; 56 return in_memory_url_index;
57 } 57 }
58 58
59 content::BrowserContext* InMemoryURLIndexFactory::GetBrowserContextToUse( 59 content::BrowserContext* InMemoryURLIndexFactory::GetBrowserContextToUse(
60 content::BrowserContext* context) const { 60 content::BrowserContext* context) const {
61 return chrome::GetBrowserContextRedirectedInIncognito(context); 61 return chrome::GetBrowserContextRedirectedInIncognito(context);
62 } 62 }
63 63
64 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const { 64 bool InMemoryURLIndexFactory::ServiceIsNULLWhileTesting() const {
65 return true; 65 return true;
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698