OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
15 #include "chrome/browser/history/history_service_factory.h" | 15 #include "chrome/browser/history/history_service_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/renderer_preferences_util.h" | 17 #include "chrome/browser/renderer_preferences_util.h" |
18 #include "chrome/browser/ssl/ssl_error_info.h" | 18 #include "chrome/browser/ssl/ssl_error_info.h" |
19 #include "chrome/browser/ui/browser.h" | |
20 #include "chrome/browser/ui/browser_finder.h" | |
21 #include "content/public/browser/cert_store.h" | 19 #include "content/public/browser/cert_store.h" |
22 #include "content/public/browser/interstitial_page.h" | 20 #include "content/public/browser/interstitial_page.h" |
23 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
24 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
25 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
27 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
28 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
29 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
30 #include "content/public/common/ssl_status.h" | 28 #include "content/public/common/ssl_status.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 404 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
407 int cert_id = content::CertStore::GetInstance()->StoreCert( | 405 int cert_id = content::CertStore::GetInstance()->StoreCert( |
408 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); | 406 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); |
409 DCHECK(cert_id); | 407 DCHECK(cert_id); |
410 | 408 |
411 entry->GetSSL().security_style = | 409 entry->GetSSL().security_style = |
412 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 410 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
413 entry->GetSSL().cert_id = cert_id; | 411 entry->GetSSL().cert_id = cert_id; |
414 entry->GetSSL().cert_status = ssl_info_.cert_status; | 412 entry->GetSSL().cert_status = ssl_info_.cert_status; |
415 entry->GetSSL().security_bits = ssl_info_.security_bits; | 413 entry->GetSSL().security_bits = ssl_info_.security_bits; |
416 #if !defined(OS_ANDROID) | |
417 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | |
418 if (browser) | |
419 browser->VisibleSSLStateChanged(web_contents_); | |
420 #endif // !defined(OS_ANDROID) | |
davidben
2014/05/28 19:29:36
This block isn't necessary. InterstitialPageImpl::
| |
421 } | 414 } |
422 | 415 |
423 // Matches events defined in ssl_error.html and ssl_roadblock.html. | 416 // Matches events defined in ssl_error.html and ssl_roadblock.html. |
424 void SSLBlockingPage::CommandReceived(const std::string& command) { | 417 void SSLBlockingPage::CommandReceived(const std::string& command) { |
425 int cmd = atoi(command.c_str()); | 418 int cmd = atoi(command.c_str()); |
426 if (cmd == CMD_DONT_PROCEED) { | 419 if (cmd == CMD_DONT_PROCEED) { |
427 interstitial_page_->DontProceed(); | 420 interstitial_page_->DontProceed(); |
428 } else if (cmd == CMD_PROCEED) { | 421 } else if (cmd == CMD_PROCEED) { |
429 interstitial_page_->Proceed(); | 422 interstitial_page_->Proceed(); |
430 } else if (cmd == CMD_MORE) { | 423 } else if (cmd == CMD_MORE) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 // sure we don't clear the captive portal flag, since the interstitial was | 529 // sure we don't clear the captive portal flag, since the interstitial was |
537 // potentially caused by the captive portal. | 530 // potentially caused by the captive portal. |
538 captive_portal_detected_ = captive_portal_detected_ || | 531 captive_portal_detected_ = captive_portal_detected_ || |
539 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 532 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
540 // Also keep track of non-HTTP portals and error cases. | 533 // Also keep track of non-HTTP portals and error cases. |
541 captive_portal_no_response_ = captive_portal_no_response_ || | 534 captive_portal_no_response_ = captive_portal_no_response_ || |
542 (results->result == captive_portal::RESULT_NO_RESPONSE); | 535 (results->result == captive_portal::RESULT_NO_RESPONSE); |
543 } | 536 } |
544 #endif | 537 #endif |
545 } | 538 } |
OLD | NEW |