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

Side by Side 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, 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 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/ssl/chrome_ssl_host_state_delegate_factory.h"
6
7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
13
14 namespace {
15
16 class Service : public KeyedService {
17 public:
18 explicit Service(Profile* profile)
19 : decisions_(new ChromeSSLHostStateDelegate(profile)) {}
20
21 ChromeSSLHostStateDelegate* decisions() { return decisions_.get(); }
22
23 virtual void Shutdown() OVERRIDE { decisions_->ShutdownOnUIThread(); }
24
25 private:
26 scoped_ptr<ChromeSSLHostStateDelegate> decisions_;
27
28 DISALLOW_COPY_AND_ASSIGN(Service);
29 };
30
31 } // namespace
32
33 // static
34 ChromeSSLHostStateDelegate* ChromeSSLHostStateDelegateFactory::GetForProfile(
35 Profile* profile) {
36 return static_cast<Service*>(GetInstance()->GetServiceForBrowserContext(
37 profile, true))->decisions();
38 }
39
40 // static
41 ChromeSSLHostStateDelegateFactory*
42 ChromeSSLHostStateDelegateFactory::GetInstance() {
43 return Singleton<ChromeSSLHostStateDelegateFactory>::get();
44 }
45
46 ChromeSSLHostStateDelegateFactory::ChromeSSLHostStateDelegateFactory()
47 : BrowserContextKeyedServiceFactory(
48 "ChromeSSLHostStateDelegate",
49 BrowserContextDependencyManager::GetInstance()) {
50 }
51
52 ChromeSSLHostStateDelegateFactory::~ChromeSSLHostStateDelegateFactory() {
53 }
54
55 KeyedService* ChromeSSLHostStateDelegateFactory::BuildServiceInstanceFor(
56 content::BrowserContext* profile) const {
57 return new Service(static_cast<Profile*>(profile));
58 }
59
60 void ChromeSSLHostStateDelegateFactory::RegisterProfilePrefs(
61 user_prefs::PrefRegistrySyncable* registry) {
62 }
63
64 content::BrowserContext*
65 ChromeSSLHostStateDelegateFactory::GetBrowserContextToUse(
66 content::BrowserContext* context) const {
67 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698