| Index: chrome/browser/ssl/chrome_ssl_host_state_decisions_factory.cc
|
| diff --git a/chrome/browser/ssl/chrome_ssl_host_state_decisions_factory.cc b/chrome/browser/ssl/chrome_ssl_host_state_decisions_factory.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0cfd48a81838166c5e386e3a311ec96588858057
|
| --- /dev/null
|
| +++ b/chrome/browser/ssl/chrome_ssl_host_state_decisions_factory.cc
|
| @@ -0,0 +1,68 @@
|
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ssl/chrome_ssl_host_state_decisions_factory.h"
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "chrome/browser/profiles/incognito_helpers.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/ssl/chrome_ssl_host_state_decisions.h"
|
| +#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
| +#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
|
| +
|
| +namespace {
|
| +
|
| +class Service : public KeyedService {
|
| + public:
|
| + explicit Service(Profile* profile)
|
| + : decisions_(new ChromeSSLHostStateDecisions(profile)) {}
|
| +
|
| + ChromeSSLHostStateDecisions* decisions() { return decisions_.get(); }
|
| +
|
| + virtual void Shutdown() OVERRIDE { decisions_->ShutdownOnUIThread(); }
|
| +
|
| + private:
|
| + scoped_ptr<ChromeSSLHostStateDecisions> decisions_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(Service);
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +// static
|
| +ChromeSSLHostStateDecisions* ChromeSSLHostStateDecisionsFactory::GetForProfile(
|
| + Profile* profile) {
|
| + return static_cast<Service*>(GetInstance()->GetServiceForBrowserContext(
|
| + profile, true))->decisions();
|
| +}
|
| +
|
| +// static
|
| +ChromeSSLHostStateDecisionsFactory*
|
| +ChromeSSLHostStateDecisionsFactory::GetInstance() {
|
| + return Singleton<ChromeSSLHostStateDecisionsFactory>::get();
|
| +}
|
| +
|
| +ChromeSSLHostStateDecisionsFactory::ChromeSSLHostStateDecisionsFactory()
|
| + : BrowserContextKeyedServiceFactory(
|
| + "ChromeSSLHostStateDecisions",
|
| + BrowserContextDependencyManager::GetInstance()) {
|
| +}
|
| +
|
| +ChromeSSLHostStateDecisionsFactory::~ChromeSSLHostStateDecisionsFactory() {
|
| +}
|
| +
|
| +KeyedService* ChromeSSLHostStateDecisionsFactory::BuildServiceInstanceFor(
|
| + content::BrowserContext* profile) const {
|
| + return new Service(static_cast<Profile*>(profile));
|
| +}
|
| +
|
| +void ChromeSSLHostStateDecisionsFactory::RegisterProfilePrefs(
|
| + user_prefs::PrefRegistrySyncable* registry) {
|
| +}
|
| +
|
| +content::BrowserContext*
|
| +ChromeSSLHostStateDecisionsFactory::GetBrowserContextToUse(
|
| + content::BrowserContext* context) const {
|
| + return chrome::GetBrowserContextOwnInstanceInIncognito(context);
|
| +}
|
|
|