OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "webkit/glue/resource_type.h" | 11 #include "webkit/glue/resource_type.h" |
12 | 12 |
13 class NavigationEntry; | |
14 class SSLCertErrorHandler; | 13 class SSLCertErrorHandler; |
15 class SSLPolicyBackend; | 14 class SSLPolicyBackend; |
16 class SSLRequestInfo; | 15 class SSLRequestInfo; |
17 class TabContents; | 16 class TabContents; |
18 | 17 |
| 18 namespace content { |
| 19 class NavigationEntryImpl; |
| 20 } |
| 21 |
19 // SSLPolicy | 22 // SSLPolicy |
20 // | 23 // |
21 // This class is responsible for making the security decisions that concern the | 24 // This class is responsible for making the security decisions that concern the |
22 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact | 25 // SSL trust indicators. It relies on the SSLPolicyBackend to actually enact |
23 // the decisions it reaches. | 26 // the decisions it reaches. |
24 // | 27 // |
25 class SSLPolicy { | 28 class SSLPolicy { |
26 public: | 29 public: |
27 explicit SSLPolicy(SSLPolicyBackend* backend); | 30 explicit SSLPolicy(SSLPolicyBackend* backend); |
28 | 31 |
29 // An error occurred with the certificate in an SSL connection. | 32 // An error occurred with the certificate in an SSL connection. |
30 void OnCertError(SSLCertErrorHandler* handler); | 33 void OnCertError(SSLCertErrorHandler* handler); |
31 | 34 |
32 void DidRunInsecureContent(NavigationEntry* entry, | 35 void DidRunInsecureContent(content::NavigationEntryImpl* entry, |
33 const std::string& security_origin); | 36 const std::string& security_origin); |
34 | 37 |
35 // We have started a resource request with the given info. | 38 // We have started a resource request with the given info. |
36 void OnRequestStarted(SSLRequestInfo* info); | 39 void OnRequestStarted(SSLRequestInfo* info); |
37 | 40 |
38 // Update the SSL information in |entry| to match the current state. | 41 // Update the SSL information in |entry| to match the current state. |
39 // |tab_contents| is the TabContents associated with this entry. | 42 // |tab_contents| is the TabContents associated with this entry. |
40 void UpdateEntry(NavigationEntry* entry, TabContents* tab_contents); | 43 void UpdateEntry(content::NavigationEntryImpl* entry, |
| 44 TabContents* tab_contents); |
41 | 45 |
42 SSLPolicyBackend* backend() const { return backend_; } | 46 SSLPolicyBackend* backend() const { return backend_; } |
43 | 47 |
44 private: | 48 private: |
45 // Callback that the user chose to accept or deny the certificate. | 49 // Callback that the user chose to accept or deny the certificate. |
46 void OnAllowCertificate(SSLCertErrorHandler* handler, bool allow); | 50 void OnAllowCertificate(SSLCertErrorHandler* handler, bool allow); |
47 | 51 |
48 // Helper method for derived classes handling certificate errors. | 52 // Helper method for derived classes handling certificate errors. |
49 // If the error can be overridden by the user, show a blocking page that | 53 // If the error can be overridden by the user, show a blocking page that |
50 // lets the user continue or cancel the request. | 54 // lets the user continue or cancel the request. |
51 // For fatal certificate errors, show a blocking page that only lets the | 55 // For fatal certificate errors, show a blocking page that only lets the |
52 // user cancel the request. | 56 // user cancel the request. |
53 void OnCertErrorInternal(SSLCertErrorHandler* handler, bool overridable); | 57 void OnCertErrorInternal(SSLCertErrorHandler* handler, bool overridable); |
54 | 58 |
55 // If the security style of |entry| has not been initialized, then initialize | 59 // If the security style of |entry| has not been initialized, then initialize |
56 // it with the default style for its URL. | 60 // it with the default style for its URL. |
57 void InitializeEntryIfNeeded(NavigationEntry* entry); | 61 void InitializeEntryIfNeeded(content::NavigationEntryImpl* entry); |
58 | 62 |
59 // Mark |origin| as having run insecure content in the process with ID |pid|. | 63 // Mark |origin| as having run insecure content in the process with ID |pid|. |
60 void OriginRanInsecureContent(const std::string& origin, int pid); | 64 void OriginRanInsecureContent(const std::string& origin, int pid); |
61 | 65 |
62 // The backend we use to enact our decisions. | 66 // The backend we use to enact our decisions. |
63 SSLPolicyBackend* backend_; | 67 SSLPolicyBackend* backend_; |
64 | 68 |
65 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); | 69 DISALLOW_COPY_AND_ASSIGN(SSLPolicy); |
66 }; | 70 }; |
67 | 71 |
68 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ | 72 #endif // CONTENT_BROWSER_SSL_SSL_POLICY_H_ |
OLD | NEW |