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

Side by Side Diff: content/browser/ssl/ssl_host_state.cc

Issue 418133012: Add button to page info to revoke user certificate decisions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits from pkasting and rsesek 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) 2012 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 "content/browser/ssl/ssl_host_state.h"
6
7 #include "base/logging.h"
8 #include "base/lazy_instance.h"
9 #include "content/public/browser/browser_context.h"
10
11 const char kKeyName[] = "content_ssl_host_state";
12
13 namespace content {
14
15 SSLHostState* SSLHostState::GetFor(BrowserContext* context) {
16 SSLHostState* rv = static_cast<SSLHostState*>(context->GetUserData(kKeyName));
17 if (!rv) {
18 rv = new SSLHostState();
19 context->SetUserData(kKeyName, rv);
20 }
21 return rv;
22 }
23
24 SSLHostState::SSLHostState() {
25 }
26
27 SSLHostState::~SSLHostState() {
28 }
29
30 void SSLHostState::HostRanInsecureContent(const std::string& host, int pid) {
31 DCHECK(CalledOnValidThread());
32 ran_insecure_content_hosts_.insert(BrokenHostEntry(host, pid));
33 }
34
35 bool SSLHostState::DidHostRunInsecureContent(const std::string& host,
36 int pid) const {
37 DCHECK(CalledOnValidThread());
38 return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid));
39 }
40
41 void SSLHostState::DenyCertForHost(net::X509Certificate* cert,
42 const std::string& host,
43 net::CertStatus error) {
44 DCHECK(CalledOnValidThread());
45
46 cert_policy_for_host_[host].Deny(cert, error);
47 }
48
49 void SSLHostState::AllowCertForHost(net::X509Certificate* cert,
50 const std::string& host,
51 net::CertStatus error) {
52 DCHECK(CalledOnValidThread());
53
54 cert_policy_for_host_[host].Allow(cert, error);
55 }
56
57 void SSLHostState::Clear() {
58 DCHECK(CalledOnValidThread());
59
60 cert_policy_for_host_.clear();
61 }
62
63 net::CertPolicy::Judgment SSLHostState::QueryPolicy(net::X509Certificate* cert,
64 const std::string& host,
65 net::CertStatus error) {
66 DCHECK(CalledOnValidThread());
67
68 return cert_policy_for_host_[host].Check(cert, error);
69 }
70
71 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698