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

Unified Diff: chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.cc

Issue 369703002: Remember user decisions on invalid certificates behind a flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed broken include Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.cc
diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..eb5fb24f2b4c4095db7eb8dbf81a3523662b6b7c
--- /dev/null
+++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate_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_delegate_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_delegate.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 ChromeSSLHostStateDelegate(profile)) {}
+
+ ChromeSSLHostStateDelegate* decisions() { return decisions_.get(); }
+
+ virtual void Shutdown() OVERRIDE { decisions_->ShutdownOnUIThread(); }
+
+ private:
+ scoped_ptr<ChromeSSLHostStateDelegate> decisions_;
+
+ DISALLOW_COPY_AND_ASSIGN(Service);
+};
+
+} // namespace
+
+// static
+ChromeSSLHostStateDelegate* ChromeSSLHostStateDelegateFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<Service*>(GetInstance()->GetServiceForBrowserContext(
+ profile, true))->decisions();
+}
+
+// static
+ChromeSSLHostStateDelegateFactory*
+ChromeSSLHostStateDelegateFactory::GetInstance() {
+ return Singleton<ChromeSSLHostStateDelegateFactory>::get();
+}
+
+ChromeSSLHostStateDelegateFactory::ChromeSSLHostStateDelegateFactory()
+ : BrowserContextKeyedServiceFactory(
+ "ChromeSSLHostStateDelegate",
+ BrowserContextDependencyManager::GetInstance()) {
+}
+
+ChromeSSLHostStateDelegateFactory::~ChromeSSLHostStateDelegateFactory() {
+}
+
+KeyedService* ChromeSSLHostStateDelegateFactory::BuildServiceInstanceFor(
+ content::BrowserContext* profile) const {
+ return new Service(static_cast<Profile*>(profile));
+}
+
+void ChromeSSLHostStateDelegateFactory::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+}
+
+content::BrowserContext*
+ChromeSSLHostStateDelegateFactory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
+ return chrome::GetBrowserContextOwnInstanceInIncognito(context);
+}

Powered by Google App Engine
This is Rietveld 408576698