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

Side by Side Diff: chrome/browser/ssl/ssl_policy_backend.cc

Issue 2095006: Revert 47347 - (Original patch reviewed at http://codereview.chromium.org/206... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 7 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_policy_backend.h ('k') | chrome/browser/tab_contents/navigation_entry.h » ('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) 2010 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 #include "chrome/browser/ssl/ssl_policy_backend.h" 5 #include "chrome/browser/ssl/ssl_policy_backend.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "chrome/browser/profile.h" 8 #include "chrome/browser/profile.h"
9 #include "chrome/browser/ssl/ssl_host_state.h" 9 #include "chrome/browser/ssl/ssl_host_state.h"
10 #include "chrome/browser/tab_contents/infobar_delegate.h" 10 #include "chrome/browser/tab_contents/infobar_delegate.h"
11 #include "chrome/browser/tab_contents/navigation_controller.h" 11 #include "chrome/browser/tab_contents/navigation_controller.h"
12 #include "chrome/browser/tab_contents/navigation_entry.h" 12 #include "chrome/browser/tab_contents/navigation_entry.h"
13 #include "chrome/browser/tab_contents/tab_contents.h" 13 #include "chrome/browser/tab_contents/tab_contents.h"
14 #include "chrome/common/notification_service.h"
14 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
15 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
16 17
17 class SSLInfoBarDelegate : public ConfirmInfoBarDelegate { 18 class SSLInfoBarDelegate : public ConfirmInfoBarDelegate {
18 public: 19 public:
19 SSLInfoBarDelegate(TabContents* contents, 20 SSLInfoBarDelegate(TabContents* contents,
20 const std::wstring message, 21 const std::wstring message,
21 const std::wstring& button_label, 22 const std::wstring& button_label,
22 Task* task) 23 Task* task)
23 : ConfirmInfoBarDelegate(contents), 24 : ConfirmInfoBarDelegate(contents),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (entry->ssl().security_style() <= SECURITY_STYLE_UNAUTHENTICATED) 96 if (entry->ssl().security_style() <= SECURITY_STYLE_UNAUTHENTICATED)
96 return; 97 return;
97 98
98 if (controller_->tab_contents()) { 99 if (controller_->tab_contents()) {
99 controller_->tab_contents()->AddInfoBar( 100 controller_->tab_contents()->AddInfoBar(
100 new SSLInfoBarDelegate(controller_->tab_contents(), msg, link_text, 101 new SSLInfoBarDelegate(controller_->tab_contents(), msg, link_text,
101 task)); 102 task));
102 } 103 }
103 } 104 }
104 105
105 void SSLPolicyBackend::HostRanInsecureContent(const std::string& host, 106 void SSLPolicyBackend::MarkHostAsBroken(const std::string& host, int id) {
106 int id) { 107 ssl_host_state_->MarkHostAsBroken(host, id);
107 ssl_host_state_->HostRanInsecureContent(host, id); 108 DispatchSSLInternalStateChanged();
108 SSLManager::NotifySSLInternalStateChanged();
109 } 109 }
110 110
111 bool SSLPolicyBackend::DidHostRunInsecureContent(const std::string& host, 111 bool SSLPolicyBackend::DidMarkHostAsBroken(const std::string& host,
112 int pid) const { 112 int pid) const {
113 return ssl_host_state_->DidHostRunInsecureContent(host, pid); 113 return ssl_host_state_->DidMarkHostAsBroken(host, pid);
114 } 114 }
115 115
116 void SSLPolicyBackend::DenyCertForHost(net::X509Certificate* cert, 116 void SSLPolicyBackend::DenyCertForHost(net::X509Certificate* cert,
117 const std::string& host) { 117 const std::string& host) {
118 ssl_host_state_->DenyCertForHost(cert, host); 118 ssl_host_state_->DenyCertForHost(cert, host);
119 } 119 }
120 120
121 void SSLPolicyBackend::AllowCertForHost(net::X509Certificate* cert, 121 void SSLPolicyBackend::AllowCertForHost(net::X509Certificate* cert,
122 const std::string& host) { 122 const std::string& host) {
123 ssl_host_state_->AllowCertForHost(cert, host); 123 ssl_host_state_->AllowCertForHost(cert, host);
124 } 124 }
125 125
126 net::X509Certificate::Policy::Judgment SSLPolicyBackend::QueryPolicy( 126 net::X509Certificate::Policy::Judgment SSLPolicyBackend::QueryPolicy(
127 net::X509Certificate* cert, const std::string& host) { 127 net::X509Certificate* cert, const std::string& host) {
128 return ssl_host_state_->QueryPolicy(cert, host); 128 return ssl_host_state_->QueryPolicy(cert, host);
129 } 129 }
130 130
131 void SSLPolicyBackend::DispatchSSLInternalStateChanged() {
132 NotificationService::current()->Notify(
133 NotificationType::SSL_INTERNAL_STATE_CHANGED,
134 Source<NavigationController>(controller_),
135 NotificationService::NoDetails());
136 }
137
131 void SSLPolicyBackend::ShowPendingMessages() { 138 void SSLPolicyBackend::ShowPendingMessages() {
132 std::vector<SSLMessageInfo>::const_iterator iter; 139 std::vector<SSLMessageInfo>::const_iterator iter;
133 for (iter = pending_messages_.begin(); 140 for (iter = pending_messages_.begin();
134 iter != pending_messages_.end(); ++iter) { 141 iter != pending_messages_.end(); ++iter) {
135 ShowMessageWithLink(iter->message, iter->link_text, iter->action); 142 ShowMessageWithLink(iter->message, iter->link_text, iter->action);
136 } 143 }
137 ClearPendingMessages(); 144 ClearPendingMessages();
138 } 145 }
139 146
140 void SSLPolicyBackend::ClearPendingMessages() { 147 void SSLPolicyBackend::ClearPendingMessages() {
141 pending_messages_.clear(); 148 pending_messages_.clear();
142 } 149 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_policy_backend.h ('k') | chrome/browser/tab_contents/navigation_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698