| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
| 6 #define CHROME_BROWSER_SSL_SSL_MANAGER_H_ | 6 #define CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // Find the appropriate SSLManager for the URLRequest and begin handling | 70 // Find the appropriate SSLManager for the URLRequest and begin handling |
| 71 // this error. | 71 // this error. |
| 72 // | 72 // |
| 73 // Call on UI thread. | 73 // Call on UI thread. |
| 74 void Dispatch(); | 74 void Dispatch(); |
| 75 | 75 |
| 76 // Available on either thread. | 76 // Available on either thread. |
| 77 const GURL& request_url() const { return request_url_; } | 77 const GURL& request_url() const { return request_url_; } |
| 78 | 78 |
| 79 // Available on either thread. |
| 80 ResourceType::Type resource_type() const { return resource_type_; } |
| 81 |
| 82 // Available on either thread. |
| 83 const std::string& frame_origin() const { return frame_origin_; } |
| 84 |
| 85 // Available on either thread. |
| 86 const std::string& main_frame_origin() const { return main_frame_origin_; } |
| 87 |
| 79 // Call on the UI thread. | 88 // Call on the UI thread. |
| 80 SSLManager* manager() const { return manager_; } | 89 SSLManager* manager() const { return manager_; } |
| 81 | 90 |
| 82 // Returns the WebContents this object is associated with. Should be | 91 // Returns the WebContents this object is associated with. Should be |
| 83 // called from the UI thread. | 92 // called from the UI thread. |
| 84 WebContents* GetWebContents(); | 93 WebContents* GetWebContents(); |
| 85 | 94 |
| 86 // Cancels the associated URLRequest. | 95 // Cancels the associated URLRequest. |
| 87 // This method can be called from OnDispatchFailed and OnDispatched. | 96 // This method can be called from OnDispatchFailed and OnDispatched. |
| 88 void CancelRequest(); | 97 void CancelRequest(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 111 // Does nothing on the URLRequest but ensures the current instance ref | 120 // Does nothing on the URLRequest but ensures the current instance ref |
| 112 // count is decremented appropriately. Subclasses that do not want to | 121 // count is decremented appropriately. Subclasses that do not want to |
| 113 // take any specific actions in their OnDispatched/OnDispatchFailed should | 122 // take any specific actions in their OnDispatched/OnDispatchFailed should |
| 114 // call this. | 123 // call this. |
| 115 void TakeNoAction(); | 124 void TakeNoAction(); |
| 116 | 125 |
| 117 protected: | 126 protected: |
| 118 // Construct on the IO thread. | 127 // Construct on the IO thread. |
| 119 ErrorHandler(ResourceDispatcherHost* resource_dispatcher_host, | 128 ErrorHandler(ResourceDispatcherHost* resource_dispatcher_host, |
| 120 URLRequest* request, | 129 URLRequest* request, |
| 130 ResourceType::Type resource_type, |
| 131 const std::string& frame_origin, |
| 132 const std::string& main_frame_origin, |
| 121 MessageLoop* ui_loop); | 133 MessageLoop* ui_loop); |
| 122 | 134 |
| 123 // The following 2 methods are the methods subclasses should implement. | 135 // The following 2 methods are the methods subclasses should implement. |
| 124 virtual void OnDispatchFailed() { TakeNoAction(); } | 136 virtual void OnDispatchFailed() { TakeNoAction(); } |
| 125 | 137 |
| 126 // Can use the manager_ member. | 138 // Can use the manager_ member. |
| 127 virtual void OnDispatched() { TakeNoAction(); } | 139 virtual void OnDispatched() { TakeNoAction(); } |
| 128 | 140 |
| 129 // We cache the message loops to be able to proxy events across the thread | 141 // We cache the message loops to be able to proxy events across the thread |
| 130 // boundaries. | 142 // boundaries. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 157 | 169 |
| 158 // Derefs this instance. | 170 // Derefs this instance. |
| 159 // Call on the IO thread. | 171 // Call on the IO thread. |
| 160 void CompleteTakeNoAction(); | 172 void CompleteTakeNoAction(); |
| 161 | 173 |
| 162 // We use these members to find the correct SSLManager when we arrive on | 174 // We use these members to find the correct SSLManager when we arrive on |
| 163 // the UI thread. | 175 // the UI thread. |
| 164 int render_process_host_id_; | 176 int render_process_host_id_; |
| 165 int tab_contents_id_; | 177 int tab_contents_id_; |
| 166 | 178 |
| 179 // The URL that we requested. |
| 167 // This read-only member can be accessed on any thread. | 180 // This read-only member can be accessed on any thread. |
| 168 const GURL request_url_; // The URL that we requested. | 181 const GURL request_url_; |
| 169 | 182 |
| 183 // What kind of resource is associated with the requested that generated |
| 184 // that error. |
| 185 // This read-only member can be accessed on any thread. |
| 186 const ResourceType::Type resource_type_; |
| 187 |
| 188 // The origin of the frame associated with this request. |
| 189 // This read-only member can be accessed on any thread. |
| 190 const std::string frame_origin_; |
| 191 |
| 192 // The origin of the main frame associated with this request. |
| 193 // This read-only member can be accessed on any thread. |
| 194 const std::string main_frame_origin_; |
| 195 |
| 196 // A flag to make sure we notify the URLRequest exactly once. |
| 170 // Should only be accessed on the IO thread | 197 // Should only be accessed on the IO thread |
| 171 bool request_has_been_notified_; // A flag to make sure we notify the | 198 bool request_has_been_notified_; |
| 172 // URLRequest exactly once. | |
| 173 | 199 |
| 174 DISALLOW_COPY_AND_ASSIGN(ErrorHandler); | 200 DISALLOW_COPY_AND_ASSIGN(ErrorHandler); |
| 175 }; | 201 }; |
| 176 | 202 |
| 177 // A CertError represents an error that occurred with the certificate in an | 203 // A CertError represents an error that occurred with the certificate in an |
| 178 // SSL session. A CertError object exists both on the IO thread and on the UI | 204 // SSL session. A CertError object exists both on the IO thread and on the UI |
| 179 // thread and allows us to cancel/continue a request it is associated with. | 205 // thread and allows us to cancel/continue a request it is associated with. |
| 180 class CertError : public ErrorHandler { | 206 class CertError : public ErrorHandler { |
| 181 public: | 207 public: |
| 182 | 208 |
| 183 virtual CertError* AsCertError() { return this; } | 209 virtual CertError* AsCertError() { return this; } |
| 184 | 210 |
| 185 // These accessors are available on either thread | 211 // These accessors are available on either thread |
| 186 const net::SSLInfo& ssl_info() const { return ssl_info_; } | 212 const net::SSLInfo& ssl_info() const { return ssl_info_; } |
| 187 int cert_error() const { return cert_error_; } | 213 int cert_error() const { return cert_error_; } |
| 188 | 214 |
| 189 ResourceType::Type resource_type() const { return resource_type_; } | 215 private: |
| 190 private: | |
| 191 // SSLManager is responsible for creating CertError objects. | 216 // SSLManager is responsible for creating CertError objects. |
| 192 friend class SSLManager; | 217 friend class SSLManager; |
| 193 | 218 |
| 194 // Construct on the IO thread. | 219 // Construct on the IO thread. |
| 195 // We mark this method as private because it is tricky to correctly | 220 // We mark this method as private because it is tricky to correctly |
| 196 // construct a CertError object. | 221 // construct a CertError object. |
| 197 CertError(ResourceDispatcherHost* resource_dispatcher_host, | 222 CertError(ResourceDispatcherHost* resource_dispatcher_host, |
| 198 URLRequest* request, | 223 URLRequest* request, |
| 199 ResourceType::Type resource_type, | 224 ResourceType::Type resource_type, |
| 225 const std::string& frame_origin, |
| 226 const std::string& main_frame_origin, |
| 200 int cert_error, | 227 int cert_error, |
| 201 net::X509Certificate* cert, | 228 net::X509Certificate* cert, |
| 202 MessageLoop* ui_loop); | 229 MessageLoop* ui_loop); |
| 203 | 230 |
| 204 // ErrorHandler methods | 231 // ErrorHandler methods |
| 205 virtual void OnDispatchFailed() { CancelRequest(); } | 232 virtual void OnDispatchFailed() { CancelRequest(); } |
| 206 virtual void OnDispatched() { manager_->OnCertError(this); } | 233 virtual void OnDispatched() { manager_->OnCertError(this); } |
| 207 | 234 |
| 208 // These read-only members can be accessed on any thread. | 235 // These read-only members can be accessed on any thread. |
| 209 net::SSLInfo ssl_info_; | 236 net::SSLInfo ssl_info_; |
| 210 const int cert_error_; // The error we represent. | 237 const int cert_error_; // The error we represent. |
| 211 | 238 |
| 212 // What kind of resource is associated with the requested that generated | |
| 213 // that error. | |
| 214 ResourceType::Type resource_type_; | |
| 215 | |
| 216 DISALLOW_COPY_AND_ASSIGN(CertError); | 239 DISALLOW_COPY_AND_ASSIGN(CertError); |
| 217 }; | 240 }; |
| 218 | 241 |
| 219 // The MixedContentHandler class is used to query what to do with | 242 // The MixedContentHandler class is used to query what to do with |
| 220 // mixed content, from the IO thread to the UI thread. | 243 // mixed content, from the IO thread to the UI thread. |
| 221 class MixedContentHandler : public ErrorHandler { | 244 class MixedContentHandler : public ErrorHandler { |
| 222 public: | 245 public: |
| 223 // Created on the IO thread. | 246 // Created on the IO thread. |
| 224 MixedContentHandler(ResourceDispatcherHost* rdh, | 247 MixedContentHandler(ResourceDispatcherHost* rdh, |
| 225 URLRequest* request, | 248 URLRequest* request, |
| 249 ResourceType::Type resource_type, |
| 250 const std::string& frame_origin, |
| 251 const std::string& main_frame_origin, |
| 226 MessageLoop* ui_loop) | 252 MessageLoop* ui_loop) |
| 227 : ErrorHandler(rdh, request, ui_loop) { } | 253 : ErrorHandler(rdh, request, resource_type, frame_origin, |
| 228 | 254 main_frame_origin, ui_loop) { } |
| 229 protected: | 255 protected: |
| 230 virtual void OnDispatchFailed() { TakeNoAction(); } | 256 virtual void OnDispatchFailed() { TakeNoAction(); } |
| 231 virtual void OnDispatched() { manager()->OnMixedContent(this); } | 257 virtual void OnDispatched() { manager()->OnMixedContent(this); } |
| 232 | 258 |
| 233 private: | 259 private: |
| 234 DISALLOW_COPY_AND_ASSIGN(MixedContentHandler); | 260 DISALLOW_COPY_AND_ASSIGN(MixedContentHandler); |
| 235 }; | 261 }; |
| 236 | 262 |
| 263 class RequestInfo : public base::RefCounted<RequestInfo> { |
| 264 public: |
| 265 RequestInfo(SSLManager* manager, |
| 266 const GURL& url, |
| 267 ResourceType::Type resource_type, |
| 268 const std::string& frame_origin, |
| 269 const std::string& main_frame_origin, |
| 270 int ssl_cert_id, |
| 271 int ssl_cert_status) |
| 272 : manager_(manager), |
| 273 url_(url), |
| 274 resource_type_(resource_type), |
| 275 frame_origin_(frame_origin), |
| 276 main_frame_origin_(main_frame_origin), |
| 277 ssl_cert_id_(ssl_cert_id), |
| 278 ssl_cert_status_(ssl_cert_status) { |
| 279 } |
| 280 |
| 281 SSLManager* manager() const { return manager_; } |
| 282 const GURL& url() const { return url_; } |
| 283 ResourceType::Type resource_type() const { return resource_type_; } |
| 284 const std::string& frame_origin() const { return frame_origin_; } |
| 285 const std::string& main_frame_origin() const { return main_frame_origin_; } |
| 286 int ssl_cert_id() const { return ssl_cert_id_; } |
| 287 int ssl_cert_status() const { return ssl_cert_status_; } |
| 288 |
| 289 private: |
| 290 SSLManager* manager_; |
| 291 GURL url_; |
| 292 ResourceType::Type resource_type_; |
| 293 std::string frame_origin_; |
| 294 std::string main_frame_origin_; |
| 295 int ssl_cert_id_; |
| 296 int ssl_cert_status_; |
| 297 |
| 298 DISALLOW_COPY_AND_ASSIGN(RequestInfo); |
| 299 }; |
| 300 |
| 237 // The SSLManager will ask its delegate to decide how to handle events | 301 // The SSLManager will ask its delegate to decide how to handle events |
| 238 // relevant to SSL. Delegates are expected to be stateless and intended to be | 302 // relevant to SSL. Delegates are expected to be stateless and intended to be |
| 239 // easily implementable. | 303 // easily implementable. |
| 240 // | 304 // |
| 241 // Delegates should interact with the rest of the browser only through their | 305 // Delegates should interact with the rest of the browser only through their |
| 242 // parameters and through the delegate API of the SSLManager. | 306 // parameters and through the delegate API of the SSLManager. |
| 243 // | 307 // |
| 244 // If a delegate needs to do something tricky, consider having the SSLManager | 308 // If a delegate needs to do something tricky, consider having the SSLManager |
| 245 // do it instead. | 309 // do it instead. |
| 246 class Delegate { | 310 class Delegate { |
| 247 public: | 311 public: |
| 248 // An error occurred with the certificate in an SSL connection. | 312 // An error occurred with the certificate in an SSL connection. |
| 249 virtual void OnCertError(const GURL& main_frame_url, CertError* error) = 0; | 313 virtual void OnCertError(CertError* error) = 0; |
| 250 | 314 |
| 251 // A request for a mixed-content resource was made. Note that the resource | 315 // A request for a mixed-content resource was made. Note that the resource |
| 252 // request was not started yet and the delegate is responsible for starting | 316 // request was not started yet and the delegate is responsible for starting |
| 253 // it. | 317 // it. |
| 254 virtual void OnMixedContent( | 318 virtual void OnMixedContent(MixedContentHandler* handler) = 0; |
| 255 NavigationController* navigation_controller, | |
| 256 const GURL& main_frame_url, | |
| 257 MixedContentHandler* mixed_content_handler) = 0; | |
| 258 | 319 |
| 259 // We have started a resource request for the given URL. | 320 // We have started a resource request with the given info. |
| 260 virtual void OnRequestStarted(SSLManager* manager, | 321 virtual void OnRequestStarted(RequestInfo* info) = 0; |
| 261 const GURL& url, | |
| 262 ResourceType::Type resource_type, | |
| 263 int ssl_cert_id, | |
| 264 int ssl_cert_status) = 0; | |
| 265 | 322 |
| 266 // Returns the default security style for a given URL. | 323 virtual void UpdateEntry(SSLManager* manager, NavigationEntry* entry) = 0; |
| 267 virtual SecurityStyle GetDefaultStyle(const GURL& url) = 0; | |
| 268 }; | 324 }; |
| 269 | 325 |
| 270 static void RegisterUserPrefs(PrefService* prefs); | 326 static void RegisterUserPrefs(PrefService* prefs); |
| 271 | 327 |
| 272 // Construct an SSLManager for the specified tab. | 328 // Construct an SSLManager for the specified tab. |
| 273 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. | 329 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. |
| 274 SSLManager(NavigationController* controller, Delegate* delegate); | 330 SSLManager(NavigationController* controller, Delegate* delegate); |
| 275 | 331 |
| 276 ~SSLManager(); | 332 ~SSLManager(); |
| 277 | 333 |
| 278 ////////////////////////////////////////////////////////////////////////////// | 334 ////////////////////////////////////////////////////////////////////////////// |
| 279 // Delegate API | 335 // Delegate API |
| 280 // | 336 // |
| 281 // The SSL manager expects these methods to be called by its delegate. They | 337 // The SSL manager expects these methods to be called by its delegate. They |
| 282 // exist to make Delegates easy to implement. | 338 // exist to make Delegates easy to implement. |
| 283 | 339 |
| 284 // Ensure that the specified message is displayed to the user. This will | 340 // Ensure that the specified message is displayed to the user. This will |
| 285 // display an InfoBar at the top of the associated tab. | 341 // display an InfoBar at the top of the associated tab. |
| 286 void ShowMessage(const std::wstring& msg); | 342 void ShowMessage(const std::wstring& msg); |
| 287 | 343 |
| 288 // Same as ShowMessage but also contains a link that when clicked run the | 344 // Same as ShowMessage but also contains a link that when clicked run the |
| 289 // specified task. The SSL Manager becomes the owner of the task. | 345 // specified task. The SSL Manager becomes the owner of the task. |
| 290 void ShowMessageWithLink(const std::wstring& msg, | 346 void ShowMessageWithLink(const std::wstring& msg, |
| 291 const std::wstring& link_text, | 347 const std::wstring& link_text, |
| 292 Task* task); | 348 Task* task); |
| 293 | 349 |
| 294 // Sets the maximum security style for the page. If the current security | 350 // Logs a message to the console of the page. |
| 295 // style is lower than |style|, this will not have an effect on the security | 351 void AddMessageToConsole(const std::wstring& msg, ConsoleMessageLevel level); |
| 296 // indicators. | |
| 297 // | |
| 298 // It will return true if the navigation entry was updated or false if | |
| 299 // nothing changed. The caller is responsible for broadcasting | |
| 300 // NOTIFY_SSY_STATE_CHANGED if it returns true. | |
| 301 bool SetMaxSecurityStyle(SecurityStyle style); | |
| 302 | 352 |
| 303 // Logs a message to the console of the page. | 353 void MarkHostAsBroken(const std::string& host); |
| 304 void AddMessageToConsole(const std::wstring& msg, | 354 bool DidMarkHostAsBroken(const std::string& host) const; |
| 305 ConsoleMessageLevel level); | |
| 306 | 355 |
| 307 // Records that |cert| is permitted to be used for |host| in the future. | 356 // Records that |cert| is permitted to be used for |host| in the future. |
| 308 void DenyCertForHost(net::X509Certificate* cert, const std::string& host); | 357 void DenyCertForHost(net::X509Certificate* cert, const std::string& host); |
| 309 | 358 |
| 310 // Records that |cert| is not permitted to be used for |host| in the future. | 359 // Records that |cert| is not permitted to be used for |host| in the future. |
| 311 void AllowCertForHost(net::X509Certificate* cert, const std::string& host); | 360 void AllowCertForHost(net::X509Certificate* cert, const std::string& host); |
| 312 | 361 |
| 313 // Queries whether |cert| is allowed or denied for |host|. | 362 // Queries whether |cert| is allowed or denied for |host|. |
| 314 net::X509Certificate::Policy::Judgment QueryPolicy( | 363 net::X509Certificate::Policy::Judgment QueryPolicy( |
| 315 net::X509Certificate* cert, const std::string& host); | 364 net::X509Certificate* cert, const std::string& host); |
| 316 | 365 |
| 317 // Allow mixed/unsafe content to be visible (non filtered) for the specified | 366 // Allow mixed content to be visible (non filtered). |
| 318 // URL. | 367 void AllowMixedContentForHost(const std::string& host); |
| 319 // Note that the current implementation allows on a host name basis. | |
| 320 void AllowShowInsecureContentForURL(const GURL& url); | |
| 321 | 368 |
| 322 // Returns whether the specified URL is allowed to show insecure (mixed or | 369 // Returns whether the specified host is allowed to show mixed content. |
| 323 // unsafe) content. | 370 bool DidAllowMixedContentForHost(const std::string& host) const; |
| 324 bool CanShowInsecureContent(const GURL& url); | |
| 325 | 371 |
| 326 // | 372 // |
| 327 ////////////////////////////////////////////////////////////////////////////// | 373 ////////////////////////////////////////////////////////////////////////////// |
| 328 | 374 |
| 329 // The delegate of the SSLManager. This value may be changed at any time, | 375 // The delegate of the SSLManager. This value may be changed at any time, |
| 330 // but it is not permissible for it to be NULL. | 376 // but it is not permissible for it to be NULL. |
| 331 Delegate* delegate() const { return delegate_; } | 377 Delegate* delegate() const { return delegate_; } |
| 332 void set_delegate(Delegate* delegate) { delegate_ = delegate; } | 378 void set_delegate(Delegate* delegate) { delegate_ = delegate; } |
| 333 | 379 |
| 334 // Entry point for SSLCertificateErrors. This function begins the process | 380 // Entry point for SSLCertificateErrors. This function begins the process |
| 335 // of resolving a certificate error during an SSL connection. SSLManager | 381 // of resolving a certificate error during an SSL connection. SSLManager |
| 336 // will adjust the security UI and either call |Cancel| or | 382 // will adjust the security UI and either call |Cancel| or |
| 337 // |ContinueDespiteLastError| on the URLRequest. | 383 // |ContinueDespiteLastError| on the URLRequest. |
| 338 // | 384 // |
| 339 // Called on the IO thread. | 385 // Called on the IO thread. |
| 340 static void OnSSLCertificateError(ResourceDispatcherHost* resource_dispatcher, | 386 static void OnSSLCertificateError(ResourceDispatcherHost* resource_dispatcher, |
| 341 URLRequest* request, | 387 URLRequest* request, |
| 342 int cert_error, | 388 int cert_error, |
| 343 net::X509Certificate* cert, | 389 net::X509Certificate* cert, |
| 344 MessageLoop* ui_loop); | 390 MessageLoop* ui_loop); |
| 345 | 391 |
| 346 // Called when a mixed-content sub-resource request has been detected. The | 392 // Called before a URL request has been started. Returns whether the resource |
| 347 // request is not started yet. The SSLManager will make a decision on whether | 393 // request should be delayed while we figure out what to do. We use this |
| 348 // to filter that request's content (with the filter_policy flag). | 394 // function as the entry point for our mixed content detection. |
| 395 // |
| 349 // TODO(jcampan): Implement a way to just cancel the request. This is not | 396 // TODO(jcampan): Implement a way to just cancel the request. This is not |
| 350 // straight-forward as canceling a request that has not been started will | 397 // straight-forward as canceling a request that has not been started will |
| 351 // not remove from the pending_requests_ of the ResourceDispatcherHost. | 398 // not remove from the pending_requests_ of the ResourceDispatcherHost. |
| 352 // Called on the IO thread. | 399 // Called on the IO thread. |
| 353 static void OnMixedContentRequest(ResourceDispatcherHost* resource_dispatcher, | 400 static bool ShouldDelayRequest(ResourceDispatcherHost* resource_dispatcher, |
| 354 URLRequest* request, | 401 URLRequest* request, |
| 355 MessageLoop* ui_loop); | 402 MessageLoop* ui_loop); |
| 356 | 403 |
| 357 // Called by CertError::Dispatch to kick off processing of the cert error by | 404 // Called by CertError::Dispatch to kick off processing of the cert error by |
| 358 // the SSL manager. The error originated from the ResourceDispatcherHost. | 405 // the SSL manager. The error originated from the ResourceDispatcherHost. |
| 359 // | 406 // |
| 360 // Called on the UI thread. | 407 // Called on the UI thread. |
| 361 void OnCertError(CertError* error); | 408 void OnCertError(CertError* error); |
| 362 | 409 |
| 363 // Called by MixedContentHandler::Dispatch to kick off processing of the | 410 // Called by MixedContentHandler::Dispatch to kick off processing of the |
| 364 // mixed-content resource request. The info originated from the | 411 // mixed-content resource request. The info originated from the |
| 365 // ResourceDispatcherHost. | 412 // ResourceDispatcherHost. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 476 |
| 430 // Entry points for notifications to which we subscribe. Note that | 477 // Entry points for notifications to which we subscribe. Note that |
| 431 // DidCommitProvisionalLoad uses the abstract NotificationDetails type since | 478 // DidCommitProvisionalLoad uses the abstract NotificationDetails type since |
| 432 // the type we need is in NavigationController which would create a circular | 479 // the type we need is in NavigationController which would create a circular |
| 433 // header file dependency. | 480 // header file dependency. |
| 434 void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details); | 481 void DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details); |
| 435 void DidCommitProvisionalLoad(const NotificationDetails& details); | 482 void DidCommitProvisionalLoad(const NotificationDetails& details); |
| 436 void DidFailProvisionalLoadWithError(ProvisionalLoadDetails* details); | 483 void DidFailProvisionalLoadWithError(ProvisionalLoadDetails* details); |
| 437 void DidStartResourceResponse(ResourceRequestDetails* details); | 484 void DidStartResourceResponse(ResourceRequestDetails* details); |
| 438 void DidReceiveResourceRedirect(ResourceRedirectDetails* details); | 485 void DidReceiveResourceRedirect(ResourceRedirectDetails* details); |
| 486 void DidChangeSSLInternalState(); |
| 439 | 487 |
| 440 // Convenience method for initializing navigation entries. | 488 // Dispatch NotificationType::SSL_INTERNAL_STATE_CHANGED notification. |
| 441 void InitializeEntryIfNeeded(NavigationEntry* entry); | 489 void DispatchSSLInternalStateChanged(); |
| 490 |
| 491 // Dispatch NotificationType::SSL_VISIBLE_STATE_CHANGED notification. |
| 492 void DispatchSSLVisibleStateChanged(); |
| 493 |
| 494 // Update the NavigationEntry with our current state. |
| 495 void UpdateEntry(NavigationEntry* entry); |
| 442 | 496 |
| 443 // Shows the pending messages (in info-bars) if any. | 497 // Shows the pending messages (in info-bars) if any. |
| 444 void ShowPendingMessages(); | 498 void ShowPendingMessages(); |
| 445 | 499 |
| 446 // Clears any pending messages. | 500 // Clears any pending messages. |
| 447 void ClearPendingMessages(); | 501 void ClearPendingMessages(); |
| 448 | 502 |
| 449 // Our delegate. The delegate is responsible for making policy decisions. | 503 // Our delegate. The delegate is responsible for making policy decisions. |
| 450 // Must not be NULL. | 504 // Must not be NULL. |
| 451 Delegate* delegate_; | 505 Delegate* delegate_; |
| 452 | 506 |
| 453 // The NavigationController that owns this SSLManager. We are responsible | 507 // The NavigationController that owns this SSLManager. We are responsible |
| 454 // for the security UI of this tab. | 508 // for the security UI of this tab. |
| 455 NavigationController* controller_; | 509 NavigationController* controller_; |
| 456 | 510 |
| 457 // Handles registering notifications with the NotificationService. | 511 // Handles registering notifications with the NotificationService. |
| 458 NotificationRegistrar registrar_; | 512 NotificationRegistrar registrar_; |
| 459 | 513 |
| 460 // SSL state specific for each host. | 514 // SSL state specific for each host. |
| 461 SSLHostState* ssl_host_state_; | 515 SSLHostState* ssl_host_state_; |
| 462 | 516 |
| 463 // The list of messages that should be displayed (in info bars) when the page | 517 // The list of messages that should be displayed (in info bars) when the page |
| 464 // currently loading had loaded. | 518 // currently loading had loaded. |
| 465 std::vector<SSLMessageInfo> pending_messages_; | 519 std::vector<SSLMessageInfo> pending_messages_; |
| 466 | 520 |
| 467 DISALLOW_COPY_AND_ASSIGN(SSLManager); | 521 DISALLOW_COPY_AND_ASSIGN(SSLManager); |
| 468 }; | 522 }; |
| 469 | 523 |
| 470 #endif // CHROME_BROWSER_SSL_SSL_MANAGER_H_ | 524 #endif // CHROME_BROWSER_SSL_SSL_MANAGER_H_ |
| OLD | NEW |