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 #include "chrome/browser/ssl/ssl_manager.h" | 5 #include "chrome/browser/ssl/ssl_manager.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/load_from_memory_cache_details.h" | 10 #include "chrome/browser/load_from_memory_cache_details.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 : delegate_(delegate), | 104 : delegate_(delegate), |
105 controller_(controller), | 105 controller_(controller), |
106 ssl_host_state_(controller->profile()->GetSSLHostState()) { | 106 ssl_host_state_(controller->profile()->GetSSLHostState()) { |
107 DCHECK(controller_); | 107 DCHECK(controller_); |
108 | 108 |
109 // If do delegate is supplied, use the default policy. | 109 // If do delegate is supplied, use the default policy. |
110 if (!delegate_) | 110 if (!delegate_) |
111 delegate_ = SSLPolicy::GetDefaultPolicy(); | 111 delegate_ = SSLPolicy::GetDefaultPolicy(); |
112 | 112 |
113 // Subscribe to various notifications. | 113 // Subscribe to various notifications. |
114 registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED, | |
115 Source<NavigationController>(controller_)); | |
116 registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, | 114 registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR, |
117 Source<NavigationController>(controller_)); | 115 Source<NavigationController>(controller_)); |
118 registrar_.Add(this, NotificationType::RESOURCE_RESPONSE_STARTED, | 116 registrar_.Add(this, NotificationType::RESOURCE_RESPONSE_STARTED, |
119 Source<NavigationController>(controller_)); | 117 Source<NavigationController>(controller_)); |
120 registrar_.Add(this, NotificationType::RESOURCE_RECEIVED_REDIRECT, | 118 registrar_.Add(this, NotificationType::RESOURCE_RECEIVED_REDIRECT, |
121 Source<NavigationController>(controller_)); | 119 Source<NavigationController>(controller_)); |
122 registrar_.Add(this, NotificationType::LOAD_FROM_MEMORY_CACHE, | 120 registrar_.Add(this, NotificationType::LOAD_FROM_MEMORY_CACHE, |
123 Source<NavigationController>(controller_)); | 121 Source<NavigationController>(controller_)); |
124 registrar_.Add(this, NotificationType::SSL_INTERNAL_STATE_CHANGED, | 122 registrar_.Add(this, NotificationType::SSL_INTERNAL_STATE_CHANGED, |
125 NotificationService::AllSources()); | 123 NotificationService::AllSources()); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 | 521 |
524 void SSLManager::OnMixedContent(MixedContentHandler* handler) { | 522 void SSLManager::OnMixedContent(MixedContentHandler* handler) { |
525 delegate()->OnMixedContent(handler); | 523 delegate()->OnMixedContent(handler); |
526 } | 524 } |
527 | 525 |
528 void SSLManager::Observe(NotificationType type, | 526 void SSLManager::Observe(NotificationType type, |
529 const NotificationSource& source, | 527 const NotificationSource& source, |
530 const NotificationDetails& details) { | 528 const NotificationDetails& details) { |
531 // Dispatch by type. | 529 // Dispatch by type. |
532 switch (type.value) { | 530 switch (type.value) { |
533 case NotificationType::NAV_ENTRY_COMMITTED: | |
534 DidCommitProvisionalLoad(details); | |
535 break; | |
536 case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR: | 531 case NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR: |
537 DidFailProvisionalLoadWithError( | 532 DidFailProvisionalLoadWithError( |
538 Details<ProvisionalLoadDetails>(details).ptr()); | 533 Details<ProvisionalLoadDetails>(details).ptr()); |
539 break; | 534 break; |
540 case NotificationType::RESOURCE_RESPONSE_STARTED: | 535 case NotificationType::RESOURCE_RESPONSE_STARTED: |
541 DidStartResourceResponse(Details<ResourceRequestDetails>(details).ptr()); | 536 DidStartResourceResponse(Details<ResourceRequestDetails>(details).ptr()); |
542 break; | 537 break; |
543 case NotificationType::RESOURCE_RECEIVED_REDIRECT: | 538 case NotificationType::RESOURCE_RECEIVED_REDIRECT: |
544 DidReceiveResourceRedirect( | 539 DidReceiveResourceRedirect( |
545 Details<ResourceRedirectDetails>(details).ptr()); | 540 Details<ResourceRedirectDetails>(details).ptr()); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 } | 744 } |
750 | 745 |
751 if (ca_name) { | 746 if (ca_name) { |
752 // TODO(wtc): should we show the root CA's name instead? | 747 // TODO(wtc): should we show the root CA's name instead? |
753 *ca_name = l10n_util::GetStringF( | 748 *ca_name = l10n_util::GetStringF( |
754 IDS_SECURE_CONNECTION_EV_CA, | 749 IDS_SECURE_CONNECTION_EV_CA, |
755 UTF8ToWide(cert.issuer().organization_names[0])); | 750 UTF8ToWide(cert.issuer().organization_names[0])); |
756 } | 751 } |
757 return true; | 752 return true; |
758 } | 753 } |
OLD | NEW |