Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / prerender / prerender_link_manager_factory.cc
blob599c1033ce3e826b18bbb71e5fb90e5b851d97cd
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/prerender/prerender_link_manager_factory.h"
7 #include "chrome/browser/prerender/prerender_link_manager.h"
8 #include "chrome/browser/prerender/prerender_manager.h"
9 #include "chrome/browser/prerender/prerender_manager_factory.h"
10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
14 namespace prerender {
16 // static
17 PrerenderLinkManager* PrerenderLinkManagerFactory::GetForProfile(
18 Profile* profile) {
19 return static_cast<PrerenderLinkManager*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true));
23 // static
24 PrerenderLinkManagerFactory* PrerenderLinkManagerFactory::GetInstance() {
25 return Singleton<PrerenderLinkManagerFactory>::get();
28 PrerenderLinkManagerFactory::PrerenderLinkManagerFactory()
29 : BrowserContextKeyedServiceFactory(
30 "PrerenderLinkmanager",
31 BrowserContextDependencyManager::GetInstance()) {
32 DependsOn(prerender::PrerenderManagerFactory::GetInstance());
35 KeyedService* PrerenderLinkManagerFactory::BuildServiceInstanceFor(
36 content::BrowserContext* profile) const {
37 PrerenderManager* prerender_manager =
38 PrerenderManagerFactory::GetForProfile(static_cast<Profile*>(profile));
39 if (!prerender_manager)
40 return NULL;
41 PrerenderLinkManager* prerender_link_manager =
42 new PrerenderLinkManager(prerender_manager);
43 return prerender_link_manager;
46 content::BrowserContext* PrerenderLinkManagerFactory::GetBrowserContextToUse(
47 content::BrowserContext* context) const {
48 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
51 } // namespace prerender