OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ |
6 #define CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ | 6 #define CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
12 #include "chrome/browser/ssl/ssl_manager.h" | 12 #include "chrome/browser/ssl/ssl_manager.h" |
13 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 13 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
14 #include "chrome/common/filter_policy.h" | 14 #include "chrome/common/filter_policy.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 #include "webkit/glue/resource_type.h" | 16 #include "webkit/glue/resource_type.h" |
17 | 17 |
18 class MessageLoop; | |
19 class SSLCertErrorHandler; | 18 class SSLCertErrorHandler; |
20 class TabContents; | 19 class TabContents; |
21 class URLRequest; | 20 class URLRequest; |
22 | 21 |
23 // An SSLErrorHandler carries information from the IO thread to the UI thread | 22 // An SSLErrorHandler carries information from the IO thread to the UI thread |
24 // and is dispatched to the appropriate SSLManager when it arrives on the | 23 // and is dispatched to the appropriate SSLManager when it arrives on the |
25 // UI thread. Subclasses should override the OnDispatched/OnDispatchFailed | 24 // UI thread. Subclasses should override the OnDispatched/OnDispatchFailed |
26 // methods to implement the actions that should be taken on the UI thread. | 25 // methods to implement the actions that should be taken on the UI thread. |
27 // These methods can call the different convenience methods ContinueRequest/ | 26 // These methods can call the different convenience methods ContinueRequest/ |
28 // CancelRequest/StartRequest to perform any required action on the URLRequest | 27 // CancelRequest/StartRequest to perform any required action on the URLRequest |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // take any specific actions in their OnDispatched/OnDispatchFailed should | 91 // take any specific actions in their OnDispatched/OnDispatchFailed should |
93 // call this. | 92 // call this. |
94 void TakeNoAction(); | 93 void TakeNoAction(); |
95 | 94 |
96 protected: | 95 protected: |
97 // Construct on the IO thread. | 96 // Construct on the IO thread. |
98 SSLErrorHandler(ResourceDispatcherHost* resource_dispatcher_host, | 97 SSLErrorHandler(ResourceDispatcherHost* resource_dispatcher_host, |
99 URLRequest* request, | 98 URLRequest* request, |
100 ResourceType::Type resource_type, | 99 ResourceType::Type resource_type, |
101 const std::string& frame_origin, | 100 const std::string& frame_origin, |
102 const std::string& main_frame_origin, | 101 const std::string& main_frame_origin); |
103 MessageLoop* ui_loop); | |
104 | 102 |
105 // The following 2 methods are the methods subclasses should implement. | 103 // The following 2 methods are the methods subclasses should implement. |
106 virtual void OnDispatchFailed() { TakeNoAction(); } | 104 virtual void OnDispatchFailed() { TakeNoAction(); } |
107 | 105 |
108 // Can use the manager_ member. | 106 // Can use the manager_ member. |
109 virtual void OnDispatched() { TakeNoAction(); } | 107 virtual void OnDispatched() { TakeNoAction(); } |
110 | 108 |
111 // We cache the message loops to be able to proxy events across the thread | |
112 // boundaries. | |
113 MessageLoop* ui_loop_; | |
114 MessageLoop* io_loop_; | |
115 | |
116 // Should only be accessed on the UI thread. | 109 // Should only be accessed on the UI thread. |
117 SSLManager* manager_; // Our manager. | 110 SSLManager* manager_; // Our manager. |
118 | 111 |
119 // The id of the URLRequest associated with this object. | 112 // The id of the URLRequest associated with this object. |
120 // Should only be accessed from the IO thread. | 113 // Should only be accessed from the IO thread. |
121 ResourceDispatcherHost::GlobalRequestID request_id_; | 114 ResourceDispatcherHost::GlobalRequestID request_id_; |
122 | 115 |
123 // The ResourceDispatcherHost we are associated with. | 116 // The ResourceDispatcherHost we are associated with. |
124 ResourceDispatcherHost* resource_dispatcher_host_; | 117 ResourceDispatcherHost* resource_dispatcher_host_; |
125 | 118 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 const std::string main_frame_origin_; | 157 const std::string main_frame_origin_; |
165 | 158 |
166 // A flag to make sure we notify the URLRequest exactly once. | 159 // A flag to make sure we notify the URLRequest exactly once. |
167 // Should only be accessed on the IO thread | 160 // Should only be accessed on the IO thread |
168 bool request_has_been_notified_; | 161 bool request_has_been_notified_; |
169 | 162 |
170 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); | 163 DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); |
171 }; | 164 }; |
172 | 165 |
173 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ | 166 #endif // CHROME_BROWSER_SSL_SSL_ERROR_HANDLER_H_ |
OLD | NEW |