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

Side by Side Diff: chrome/browser/ssl/chrome_ssl_host_state_decisions_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: Fixes from felt plus new incognito browser tests 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 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_decisions_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_decisions.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 ChromeSSLHostStateDecisions(profile);
20 }
21
22 ChromeSSLHostStateDecisions* decisions() { return decisions_.get(); }
23
24 virtual void Shutdown() OVERRIDE { decisions_->ShutdownOnUIThread(); }
25
26 private:
27 scoped_refptr<ChromeSSLHostStateDecisions> decisions_;
28
29 DISALLOW_COPY_AND_ASSIGN(Service);
30 };
31
32 } // namespace
33
34 // static
35 ChromeSSLHostStateDecisions* ChromeSSLHostStateDecisionsFactory::GetForProfile(
36 Profile* profile) {
37 return static_cast<Service*>(GetInstance()->GetServiceForBrowserContext(
38 profile, true))->decisions();
39 }
40
41 // static
42 ChromeSSLHostStateDecisionsFactory*
43 ChromeSSLHostStateDecisionsFactory::GetInstance() {
44 return Singleton<ChromeSSLHostStateDecisionsFactory>::get();
45 }
46
47 ChromeSSLHostStateDecisionsFactory::ChromeSSLHostStateDecisionsFactory()
48 : BrowserContextKeyedServiceFactory(
49 "ChromeSSLHostStateDecisions",
50 BrowserContextDependencyManager::GetInstance()) {
51 }
52
53 ChromeSSLHostStateDecisionsFactory::~ChromeSSLHostStateDecisionsFactory() {
54 }
55
56 KeyedService* ChromeSSLHostStateDecisionsFactory::BuildServiceInstanceFor(
57 content::BrowserContext* profile) const {
58 return new Service(static_cast<Profile*>(profile));
59 }
60
61 void ChromeSSLHostStateDecisionsFactory::RegisterProfilePrefs(
62 user_prefs::PrefRegistrySyncable* registry) {
63 }
64
65 content::BrowserContext*
66 ChromeSSLHostStateDecisionsFactory::GetBrowserContextToUse(
67 content::BrowserContext* context) const {
68 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698