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

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

Issue 7826036: Don't crash if DontProceed is chosen on the SSL interstitial page after Proceed is chosen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a browser test Created 9 years, 3 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 | « no previous file | chrome/browser/ssl/ssl_browser_tests.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_blocking_page.h" 5 #include "chrome/browser/ssl/ssl_blocking_page.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_piece.h" 9 #include "base/string_piece.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 void SSLBlockingPage::DontProceed() { 141 void SSLBlockingPage::DontProceed() {
142 RecordSSLBlockingPageStats(DONT_PROCEED); 142 RecordSSLBlockingPageStats(DONT_PROCEED);
143 143
144 NotifyDenyCertificate(); 144 NotifyDenyCertificate();
145 InterstitialPage::DontProceed(); 145 InterstitialPage::DontProceed();
146 } 146 }
147 147
148 void SSLBlockingPage::NotifyDenyCertificate() { 148 void SSLBlockingPage::NotifyDenyCertificate() {
149 DCHECK(callback_); 149 // It's possible that callback_ may not exist if the user clicks "Proceed"
150 // followed by pressing the back button before the interstitial is hidden.
151 // In that case the certificate will still be treated as allowed.
152 if (!callback_)
153 return;
150 154
151 callback_->Run(handler_, false); 155 callback_->Run(handler_, false);
152 delete callback_; 156 delete callback_;
153 callback_ = NULL; 157 callback_ = NULL;
154 } 158 }
155 159
156 void SSLBlockingPage::NotifyAllowCertificate() { 160 void SSLBlockingPage::NotifyAllowCertificate() {
157 DCHECK(callback_); 161 DCHECK(callback_);
wtc 2011/09/02 20:43:15 Does this DCHECK need the same treatment?
158 162
159 callback_->Run(handler_, true); 163 callback_->Run(handler_, true);
160 delete callback_; 164 delete callback_;
161 callback_ = NULL; 165 callback_ = NULL;
162 } 166 }
163 167
164 // static 168 // static
165 void SSLBlockingPage::SetExtraInfo( 169 void SSLBlockingPage::SetExtraInfo(
166 DictionaryValue* strings, 170 DictionaryValue* strings,
167 const std::vector<string16>& extra_info) { 171 const std::vector<string16>& extra_info) {
168 DCHECK(extra_info.size() < 5); // We allow 5 paragraphs max. 172 DCHECK(extra_info.size() < 5); // We allow 5 paragraphs max.
169 const char* keys[5] = { 173 const char* keys[5] = {
170 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" 174 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5"
171 }; 175 };
172 int i; 176 int i;
173 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { 177 for (i = 0; i < static_cast<int>(extra_info.size()); i++) {
174 strings->SetString(keys[i], extra_info[i]); 178 strings->SetString(keys[i], extra_info[i]);
175 } 179 }
176 for (; i < 5; i++) { 180 for (; i < 5; i++) {
177 strings->SetString(keys[i], ""); 181 strings->SetString(keys[i], "");
178 } 182 }
179 } 183 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698