Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/content_settings/permission_observer_factory.h" | |
| 6 | |
| 7 #include "chrome/browser/content_settings/permission_observer.h" | |
| 8 #include "chrome/browser/profiles/incognito_helpers.h" | |
| 9 #include "chrome/browser/profiles/profile.h" | |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 11 | |
| 12 // static | |
| 13 PermissionObserver* | |
| 14 PermissionObserverFactory::GetForProfile(Profile* profile) { | |
| 15 return static_cast<PermissionObserver*>( | |
| 16 GetInstance()->GetServiceForBrowserContext(profile, true)); | |
| 17 } | |
| 18 | |
| 19 // static | |
| 20 PermissionObserverFactory* PermissionObserverFactory::GetInstance() { | |
| 21 return Singleton<PermissionObserverFactory>::get(); | |
| 22 } | |
| 23 | |
| 24 PermissionObserverFactory::PermissionObserverFactory() | |
| 25 : BrowserContextKeyedServiceFactory( | |
| 26 "PermissionObserverFactory", | |
| 27 BrowserContextDependencyManager::GetInstance()) { | |
|
Bernhard Bauer
2015/03/11 14:06:18
You need to declare your dependencies on other key
mlamouri (slow - plz ping)
2015/03/18 16:24:40
I exposed a way to get the PermissionContext relat
| |
| 28 } | |
| 29 | |
| 30 PermissionObserverFactory::~PermissionObserverFactory() { | |
| 31 } | |
| 32 | |
| 33 KeyedService* PermissionObserverFactory::BuildServiceInstanceFor( | |
| 34 content::BrowserContext* context) const { | |
| 35 return new PermissionObserver(Profile::FromBrowserContext(context)); | |
| 36 } | |
| 37 | |
| 38 content::BrowserContext* | |
| 39 PermissionObserverFactory::GetBrowserContextToUse( | |
| 40 content::BrowserContext* context) const { | |
| 41 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | |
| 42 } | |
| OLD | NEW |