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

Side by Side Diff: chrome/browser/ssl/ssl_manager.h

Issue 42314: SSLPolicy fix: Step 9. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ssl/ssl_host_state.cc ('k') | chrome/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // RequestInfo wraps up the information SSLPolicy needs about a request in 263 // RequestInfo wraps up the information SSLPolicy needs about a request in
264 // order to update our security IU. RequestInfo is RefCounted in case we need 264 // order to update our security IU. RequestInfo is RefCounted in case we need
265 // to deal with the request asynchronously. 265 // to deal with the request asynchronously.
266 class RequestInfo : public base::RefCounted<RequestInfo> { 266 class RequestInfo : public base::RefCounted<RequestInfo> {
267 public: 267 public:
268 RequestInfo(SSLManager* manager, 268 RequestInfo(SSLManager* manager,
269 const GURL& url, 269 const GURL& url,
270 ResourceType::Type resource_type, 270 ResourceType::Type resource_type,
271 const std::string& frame_origin, 271 const std::string& frame_origin,
272 const std::string& main_frame_origin, 272 const std::string& main_frame_origin,
273 FilterPolicy::Type filter_policy,
273 int ssl_cert_id, 274 int ssl_cert_id,
274 int ssl_cert_status) 275 int ssl_cert_status)
275 : manager_(manager), 276 : manager_(manager),
276 url_(url), 277 url_(url),
277 resource_type_(resource_type), 278 resource_type_(resource_type),
278 frame_origin_(frame_origin), 279 frame_origin_(frame_origin),
279 main_frame_origin_(main_frame_origin), 280 main_frame_origin_(main_frame_origin),
281 filter_policy_(filter_policy),
280 ssl_cert_id_(ssl_cert_id), 282 ssl_cert_id_(ssl_cert_id),
281 ssl_cert_status_(ssl_cert_status) { 283 ssl_cert_status_(ssl_cert_status) {
282 } 284 }
283 285
284 SSLManager* manager() const { return manager_; } 286 SSLManager* manager() const { return manager_; }
285 const GURL& url() const { return url_; } 287 const GURL& url() const { return url_; }
286 ResourceType::Type resource_type() const { return resource_type_; } 288 ResourceType::Type resource_type() const { return resource_type_; }
287 const std::string& frame_origin() const { return frame_origin_; } 289 const std::string& frame_origin() const { return frame_origin_; }
288 const std::string& main_frame_origin() const { return main_frame_origin_; } 290 const std::string& main_frame_origin() const { return main_frame_origin_; }
291 FilterPolicy::Type filter_policy() const { return filter_policy_; }
289 int ssl_cert_id() const { return ssl_cert_id_; } 292 int ssl_cert_id() const { return ssl_cert_id_; }
290 int ssl_cert_status() const { return ssl_cert_status_; } 293 int ssl_cert_status() const { return ssl_cert_status_; }
291 294
292 private: 295 private:
293 SSLManager* manager_; 296 SSLManager* manager_;
294 GURL url_; 297 GURL url_;
295 ResourceType::Type resource_type_; 298 ResourceType::Type resource_type_;
296 std::string frame_origin_; 299 std::string frame_origin_;
297 std::string main_frame_origin_; 300 std::string main_frame_origin_;
301 FilterPolicy::Type filter_policy_;
298 int ssl_cert_id_; 302 int ssl_cert_id_;
299 int ssl_cert_status_; 303 int ssl_cert_status_;
300 304
301 DISALLOW_COPY_AND_ASSIGN(RequestInfo); 305 DISALLOW_COPY_AND_ASSIGN(RequestInfo);
302 }; 306 };
303 307
304 // The SSLManager will ask its delegate to decide how to handle events 308 // The SSLManager will ask its delegate to decide how to handle events
305 // relevant to SSL. Delegates are expected to be stateless and intended to be 309 // relevant to SSL. Delegates are expected to be stateless and intended to be
306 // easily implementable. 310 // easily implementable.
307 // 311 //
308 // Delegates should interact with the rest of the browser only through their 312 // Delegates should interact with the rest of the browser only through their
309 // parameters and through the delegate API of the SSLManager. 313 // parameters and through the delegate API of the SSLManager.
310 // 314 //
311 // If a delegate needs to do something tricky, consider having the SSLManager 315 // If a delegate needs to do something tricky, consider having the SSLManager
312 // do it instead. 316 // do it instead.
313 class Delegate { 317 class Delegate {
314 public: 318 public:
315 // An error occurred with the certificate in an SSL connection. 319 // An error occurred with the certificate in an SSL connection.
316 virtual void OnCertError(CertError* error) = 0; 320 virtual void OnCertError(CertError* error) = 0;
317 321
318 // A request for a mixed-content resource was made. Note that the resource 322 // A request for a mixed-content resource was made. Note that the resource
319 // request was not started yet and the delegate is responsible for starting 323 // request was not started yet and the delegate is responsible for starting
320 // it. 324 // it.
321 virtual void OnMixedContent(MixedContentHandler* handler) = 0; 325 virtual void OnMixedContent(MixedContentHandler* handler) = 0;
322 326
323 // We have started a resource request with the given info. 327 // We have started a resource request with the given info.
324 virtual void OnRequestStarted(RequestInfo* info) = 0; 328 virtual void OnRequestStarted(RequestInfo* info) = 0;
325 329
326 // Returns the default security style for a given URL. 330 // Update the SSL information in |entry| to match the current state.
327 virtual SecurityStyle GetDefaultStyle(const GURL& url) = 0; 331 virtual void UpdateEntry(SSLManager* manager, NavigationEntry* entry) = 0;
328 }; 332 };
329 333
330 static void RegisterUserPrefs(PrefService* prefs); 334 static void RegisterUserPrefs(PrefService* prefs);
331 335
332 // Construct an SSLManager for the specified tab. 336 // Construct an SSLManager for the specified tab.
333 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used. 337 // If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used.
334 SSLManager(NavigationController* controller, Delegate* delegate); 338 SSLManager(NavigationController* controller, Delegate* delegate);
335 339
336 ~SSLManager(); 340 ~SSLManager();
337 341
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 void OnMixedContent(MixedContentHandler* handler); 438 void OnMixedContent(MixedContentHandler* handler);
435 439
436 // Entry point for navigation. This function begins the process of updating 440 // Entry point for navigation. This function begins the process of updating
437 // the security UI when the main frame navigates to a new URL. 441 // the security UI when the main frame navigates to a new URL.
438 // 442 //
439 // Called on the UI thread. 443 // Called on the UI thread.
440 virtual void Observe(NotificationType type, 444 virtual void Observe(NotificationType type,
441 const NotificationSource& source, 445 const NotificationSource& source,
442 const NotificationDetails& details); 446 const NotificationDetails& details);
443 447
444 // Entry point for navigation. This function begins the process of updating
445 // the security UI when the main frame navigates.
446 //
447 // Called on the UI thread.
448 void NavigationStateChanged();
449
450 // Called to determine if there were any processed SSL errors from request. 448 // Called to determine if there were any processed SSL errors from request.
451 bool ProcessedSSLErrorFromRequest() const; 449 bool ProcessedSSLErrorFromRequest() const;
452 450
451 // The navigation controller associated with this SSLManager. The
452 // NavigationController is guaranteed to outlive the SSLManager.
453 NavigationController* controller() { return controller_; } 453 NavigationController* controller() { return controller_; }
454 454
455 // Convenience methods for serializing/deserializing the security info. 455 // Convenience methods for serializing/deserializing the security info.
456 static std::string SerializeSecurityInfo(int cert_id, 456 static std::string SerializeSecurityInfo(int cert_id,
457 int cert_status, 457 int cert_status,
458 int security_bits); 458 int security_bits);
459 static bool DeserializeSecurityInfo(const std::string& state, 459 static bool DeserializeSecurityInfo(const std::string& state,
460 int* cert_id, 460 int* cert_id,
461 int* cert_status, 461 int* cert_status,
462 int* security_bits); 462 int* security_bits);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 void DidStartResourceResponse(ResourceRequestDetails* details); 503 void DidStartResourceResponse(ResourceRequestDetails* details);
504 void DidReceiveResourceRedirect(ResourceRedirectDetails* details); 504 void DidReceiveResourceRedirect(ResourceRedirectDetails* details);
505 void DidChangeSSLInternalState(); 505 void DidChangeSSLInternalState();
506 506
507 // Dispatch NotificationType::SSL_INTERNAL_STATE_CHANGED notification. 507 // Dispatch NotificationType::SSL_INTERNAL_STATE_CHANGED notification.
508 void DispatchSSLInternalStateChanged(); 508 void DispatchSSLInternalStateChanged();
509 509
510 // Dispatch NotificationType::SSL_VISIBLE_STATE_CHANGED notification. 510 // Dispatch NotificationType::SSL_VISIBLE_STATE_CHANGED notification.
511 void DispatchSSLVisibleStateChanged(); 511 void DispatchSSLVisibleStateChanged();
512 512
513 // Convenience method for initializing navigation entries. 513 // Update the NavigationEntry with our current state.
514 void InitializeEntryIfNeeded(NavigationEntry* entry); 514 void UpdateEntry(NavigationEntry* entry);
515 515
516 // Shows the pending messages (in info-bars) if any. 516 // Shows the pending messages (in info-bars) if any.
517 void ShowPendingMessages(); 517 void ShowPendingMessages();
518 518
519 // Clears any pending messages. 519 // Clears any pending messages.
520 void ClearPendingMessages(); 520 void ClearPendingMessages();
521 521
522 // Our delegate. The delegate is responsible for making policy decisions. 522 // Our delegate. The delegate is responsible for making policy decisions.
523 // Must not be NULL. 523 // Must not be NULL.
524 Delegate* delegate_; 524 Delegate* delegate_;
525 525
526 // The NavigationController that owns this SSLManager. We are responsible 526 // The NavigationController that owns this SSLManager. We are responsible
527 // for the security UI of this tab. 527 // for the security UI of this tab.
528 NavigationController* controller_; 528 NavigationController* controller_;
529 529
530 // Handles registering notifications with the NotificationService. 530 // Handles registering notifications with the NotificationService.
531 NotificationRegistrar registrar_; 531 NotificationRegistrar registrar_;
532 532
533 // SSL state specific for each host. 533 // SSL state specific for each host.
534 SSLHostState* ssl_host_state_; 534 SSLHostState* ssl_host_state_;
535 535
536 // The list of messages that should be displayed (in info bars) when the page 536 // The list of messages that should be displayed (in info bars) when the page
537 // currently loading had loaded. 537 // currently loading had loaded.
538 std::vector<SSLMessageInfo> pending_messages_; 538 std::vector<SSLMessageInfo> pending_messages_;
539 539
540 DISALLOW_COPY_AND_ASSIGN(SSLManager); 540 DISALLOW_COPY_AND_ASSIGN(SSLManager);
541 }; 541 };
542 542
543 #endif // CHROME_BROWSER_SSL_SSL_MANAGER_H_ 543 #endif // CHROME_BROWSER_SSL_SSL_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_host_state.cc ('k') | chrome/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698