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

Side by Side Diff: content/browser/ssl/ssl_policy.h

Issue 1244863003: Attach a SecurityStyle to each request in ResourceLoader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit test fixes Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_SSL_SSL_POLICY_H_ 5 #ifndef CONTENT_BROWSER_SSL_SSL_POLICY_H_
6 #define CONTENT_BROWSER_SSL_SSL_POLICY_H_ 6 #define CONTENT_BROWSER_SSL_SSL_POLICY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "content/public/common/resource_type.h" 11 #include "content/public/common/resource_type.h"
12 #include "content/public/common/security_style.h"
13
14 class GURL;
12 15
13 namespace content { 16 namespace content {
14 class NavigationEntryImpl; 17 class NavigationEntryImpl;
15 class SSLCertErrorHandler; 18 class SSLCertErrorHandler;
16 class SSLPolicyBackend; 19 class SSLPolicyBackend;
17 class SSLRequestInfo; 20 class SSLRequestInfo;
18 class WebContentsImpl; 21 class WebContents;
22 struct SSLStatus;
19 23
20 // SSLPolicy 24 // SSLPolicy
21 // 25 //
22 // This class is responsible for making the security decisions that concern the 26 // This class is responsible for making the security decisions that concern the
23 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact 27 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact
24 // the decisions it reaches. 28 // the decisions it reaches.
25 // 29 //
26 class SSLPolicy { 30 class SSLPolicy {
27 public: 31 public:
28 explicit SSLPolicy(SSLPolicyBackend* backend); 32 explicit SSLPolicy(SSLPolicyBackend* backend);
29 33
30 // An error occurred with the certificate in an SSL connection. 34 // An error occurred with the certificate in an SSL connection.
31 void OnCertError(SSLCertErrorHandler* handler); 35 void OnCertError(SSLCertErrorHandler* handler);
32 36
33 void DidRunInsecureContent(NavigationEntryImpl* entry, 37 void DidRunInsecureContent(NavigationEntryImpl* entry,
34 const std::string& security_origin); 38 const std::string& security_origin);
35 39
36 // We have started a resource request with the given info. 40 // We have started a resource request with the given info.
37 void OnRequestStarted(SSLRequestInfo* info); 41 void OnRequestStarted(SSLRequestInfo* info);
38 42
39 // Update the SSL information in |entry| to match the current state. 43 // Update the SSL information in |entry| to match the current state.
40 // |web_contents| is the WebContentsImpl associated with this entry. 44 // |web_contents| is the WebContents associated with this entry.
41 void UpdateEntry(NavigationEntryImpl* entry, 45 void UpdateEntry(NavigationEntryImpl* entry, WebContents* web_contents);
42 WebContentsImpl* web_contents);
43 46
44 SSLPolicyBackend* backend() const { return backend_; } 47 SSLPolicyBackend* backend() const { return backend_; }
45 48
49 // Returns a security style describing an individual resource. Does
50 // not take into account any of the page- or host-level state such as
51 // mixed content or whether the host has run insecure content.
52 static SecurityStyle GetSecurityStyleForResource(const GURL& url,
53 const SSLStatus& ssl);
54
46 private: 55 private:
47 enum OnCertErrorInternalOptionsMask { 56 enum OnCertErrorInternalOptionsMask {
48 OVERRIDABLE = 1 << 0, 57 OVERRIDABLE = 1 << 0,
49 STRICT_ENFORCEMENT = 1 << 1, 58 STRICT_ENFORCEMENT = 1 << 1,
50 EXPIRED_PREVIOUS_DECISION = 1 << 2 59 EXPIRED_PREVIOUS_DECISION = 1 << 2
51 }; 60 };
52 61
53 // Callback that the user chose to accept or deny the certificate. 62 // Callback that the user chose to accept or deny the certificate.
54 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, 63 void OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler,
55 bool allow); 64 bool allow);
(...skipping 19 matching lines...) Expand all
75 84
76 // The backend we use to enact our decisions. 85 // The backend we use to enact our decisions.
77 SSLPolicyBackend* backend_; 86 SSLPolicyBackend* backend_;
78 87
79 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); 88 DISALLOW_COPY_AND_ASSIGN(SSLPolicy);
80 }; 89 };
81 90
82 } // namespace content 91 } // namespace content
83 92
84 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ 93 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698