blob: 5a4b8226cabcf14da4984d884335efeb35740421 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright (c) 2006-2008 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.
#ifndef CHROME_BROWSER_SSL_SSL_POLICY_H_
#define CHROME_BROWSER_SSL_SSL_POLICY_H_
#include <string>
#include "chrome/browser/ssl/ssl_blocking_page.h"
#include "chrome/common/filter_policy.h"
#include "webkit/glue/resource_type.h"
class NavigationEntry;
class SSLCertErrorHandler;
class SSLPolicyBackend;
class SSLRequestInfo;
// SSLPolicy
//
// This class is responsible for making the security decisions that concern the
// SSL trust indicators. It relies on the SSLPolicyBackend to actually enact
// the decisions it reaches.
//
class SSLPolicy : public SSLBlockingPage::Delegate {
public:
explicit SSLPolicy(SSLPolicyBackend* backend);
// An error occurred with the certificate in an SSL connection.
void OnCertError(SSLCertErrorHandler* handler);
void DidDisplayInsecureContent(NavigationEntry* entry);
void DidRunInsecureContent(NavigationEntry* entry,
const std::string& security_origin);
// We have started a resource request with the given info.
void OnRequestStarted(SSLRequestInfo* info);
// Update the SSL information in |entry| to match the current state.
void UpdateEntry(NavigationEntry* entry);
SSLPolicyBackend* backend() const { return backend_; }
// SSLBlockingPage::Delegate methods.
virtual SSLErrorInfo GetSSLErrorInfo(SSLCertErrorHandler* handler);
virtual void OnDenyCertificate(SSLCertErrorHandler* handler);
virtual void OnAllowCertificate(SSLCertErrorHandler* handler);
private:
// Helper method for derived classes handling certificate errors that can be
// overridden by the user.
// Show a blocking page and let the user continue or cancel the request.
void OnOverridableCertError(SSLCertErrorHandler* handler);
// Helper method for derived classes handling fatal certificate errors.
// Cancel the request and show an error page.
void OnFatalCertError(SSLCertErrorHandler* handler);
// Show an error page for this certificate error. This error page does not
// give the user the opportunity to ingore the error.
void ShowErrorPage(SSLCertErrorHandler* handler);
// If the security style of |entry| has not been initialized, then initialize
// it with the default style for its URL.
void InitializeEntryIfNeeded(NavigationEntry* entry);
// Mark |origin| as containing insecure content in the process with ID |pid|.
void MarkOriginAsBroken(const std::string& origin, int pid);
// Called after we've decided that |info| represents a request for mixed
// content. Updates our internal state to reflect that we've loaded |info|.
void UpdateStateForMixedContent(SSLRequestInfo* info);
// Called after we've decided that |info| represents a request for unsafe
// content. Updates our internal state to reflect that we've loaded |info|.
void UpdateStateForUnsafeContent(SSLRequestInfo* info);
// The backend we use to enact our decisions.
SSLPolicyBackend* backend_;
DISALLOW_COPY_AND_ASSIGN(SSLPolicy);
};
#endif // CHROME_BROWSER_SSL_SSL_POLICY_H_
|