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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/history/history_service_factory.h" | 17 #include "chrome/browser/history/history_service_factory.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/renderer_preferences_util.h" | 19 #include "chrome/browser/renderer_preferences_util.h" |
20 #include "chrome/browser/ssl/ssl_error_info.h" | 20 #include "chrome/browser/ssl/ssl_error_info.h" |
21 #include "chrome/browser/ui/browser.h" | |
22 #include "chrome/browser/ui/browser_finder.h" | |
23 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
24 #include "content/public/browser/cert_store.h" | 22 #include "content/public/browser/cert_store.h" |
25 #include "content/public/browser/interstitial_page.h" | 23 #include "content/public/browser/interstitial_page.h" |
26 #include "content/public/browser/navigation_controller.h" | 24 #include "content/public/browser/navigation_controller.h" |
27 #include "content/public/browser/navigation_entry.h" | 25 #include "content/public/browser/navigation_entry.h" |
28 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
30 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
31 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
32 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 498 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
501 int cert_id = content::CertStore::GetInstance()->StoreCert( | 499 int cert_id = content::CertStore::GetInstance()->StoreCert( |
502 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); | 500 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); |
503 DCHECK(cert_id); | 501 DCHECK(cert_id); |
504 | 502 |
505 entry->GetSSL().security_style = | 503 entry->GetSSL().security_style = |
506 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 504 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
507 entry->GetSSL().cert_id = cert_id; | 505 entry->GetSSL().cert_id = cert_id; |
508 entry->GetSSL().cert_status = ssl_info_.cert_status; | 506 entry->GetSSL().cert_status = ssl_info_.cert_status; |
509 entry->GetSSL().security_bits = ssl_info_.security_bits; | 507 entry->GetSSL().security_bits = ssl_info_.security_bits; |
510 #if !defined(OS_ANDROID) | |
511 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | |
512 if (browser) | |
513 browser->VisibleSSLStateChanged(web_contents_); | |
514 #endif // !defined(OS_ANDROID) | |
515 } | 508 } |
516 | 509 |
517 // Matches events defined in ssl_error.html and ssl_roadblock.html. | 510 // Matches events defined in ssl_error.html and ssl_roadblock.html. |
518 void SSLBlockingPage::CommandReceived(const std::string& command) { | 511 void SSLBlockingPage::CommandReceived(const std::string& command) { |
519 int cmd = atoi(command.c_str()); | 512 int cmd = atoi(command.c_str()); |
520 // TODO(felt): Fix crbug.com/380829 and reinstate this code! | 513 // TODO(felt): Fix crbug.com/380829 and reinstate this code! |
521 /*bool retval = base::StringToInt(command, &cmd); | 514 /*bool retval = base::StringToInt(command, &cmd); |
522 DCHECK(retval);*/ | 515 DCHECK(retval);*/ |
523 switch (cmd) { | 516 switch (cmd) { |
524 case CMD_DONT_PROCEED: { | 517 case CMD_DONT_PROCEED: { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 // sure we don't clear the captive portal flag, since the interstitial was | 645 // sure we don't clear the captive portal flag, since the interstitial was |
653 // potentially caused by the captive portal. | 646 // potentially caused by the captive portal. |
654 captive_portal_detected_ = captive_portal_detected_ || | 647 captive_portal_detected_ = captive_portal_detected_ || |
655 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 648 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
656 // Also keep track of non-HTTP portals and error cases. | 649 // Also keep track of non-HTTP portals and error cases. |
657 captive_portal_no_response_ = captive_portal_no_response_ || | 650 captive_portal_no_response_ = captive_portal_no_response_ || |
658 (results->result == captive_portal::RESULT_NO_RESPONSE); | 651 (results->result == captive_portal::RESULT_NO_RESPONSE); |
659 } | 652 } |
660 #endif | 653 #endif |
661 } | 654 } |
OLD | NEW |