1 // Copyright 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.
5 #ifndef CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/threading/non_thread_safe.h"
11 #include "content/common/content_export.h"
12 #include "net/cert/x509_certificate.h"
16 // The SSLHostStateDelegate encapulates the host-specific state for SSL errors.
17 // For example, SSLHostStateDelegate remembers whether the user has whitelisted
18 // a particular broken cert for use with particular host. We separate this
19 // state from the SSLManager because this state is shared across many navigation
22 // SSLHostStateDelegate may be implemented by the embedder to provide a storage
23 // strategy for certificate decisions or it may be left unimplemented to use a
24 // default strategy of not remembering decisions at all.
25 class SSLHostStateDelegate
{
27 // The judgements that can be reached by a user for invalid certificates.
33 // Records that |cert| is permitted to be used for |host| in the future, for
34 // a specified |error| type.
35 virtual void AllowCert(const std::string
&,
36 const net::X509Certificate
& cert
,
37 net::CertStatus error
) = 0;
39 // Clear all allow preferences.
40 virtual void Clear() = 0;
42 // Queries whether |cert| is allowed for |host| and |error|. Returns true in
43 // |expired_previous_decision| if a previous user decision expired immediately
44 // prior to this query, otherwise false.
45 virtual CertJudgment
QueryPolicy(const std::string
& host
,
46 const net::X509Certificate
& cert
,
47 net::CertStatus error
,
48 bool* expired_previous_decision
) = 0;
50 // Records that a host has run insecure content.
51 virtual void HostRanInsecureContent(const std::string
& host
, int pid
) = 0;
53 // Returns whether the specified host ran insecure content.
54 virtual bool DidHostRunInsecureContent(const std::string
& host
,
58 virtual ~SSLHostStateDelegate() {}
61 } // namespace content
63 #endif // CONTENT_PUBLIC_BROWSER_SSL_HOST_STATE_DELEGATE_H_