| 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/sha1.h" | 9 #include "base/sha1.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/renderer_preferences_util.h" | 15 #include "chrome/browser/renderer_preferences_util.h" |
| 16 #include "chrome/browser/ssl/ssl_error_info.h" | 16 #include "chrome/browser/ssl/ssl_error_info.h" |
| 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_finder.h" |
| 17 #include "content/public/browser/cert_store.h" | 19 #include "content/public/browser/cert_store.h" |
| 18 #include "content/public/browser/interstitial_page.h" | 20 #include "content/public/browser/interstitial_page.h" |
| 19 #include "content/public/browser/navigation_controller.h" | 21 #include "content/public/browser/navigation_controller.h" |
| 20 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
| 21 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 22 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
| 23 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
| 25 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/common/ssl_status.h" | 28 #include "content/public/common/ssl_status.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 321 |
| 320 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 322 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
| 321 int cert_id = content::CertStore::GetInstance()->StoreCert( | 323 int cert_id = content::CertStore::GetInstance()->StoreCert( |
| 322 ssl_info_.cert, web_contents_->GetRenderProcessHost()->GetID()); | 324 ssl_info_.cert, web_contents_->GetRenderProcessHost()->GetID()); |
| 323 | 325 |
| 324 entry->GetSSL().security_style = | 326 entry->GetSSL().security_style = |
| 325 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 327 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
| 326 entry->GetSSL().cert_id = cert_id; | 328 entry->GetSSL().cert_id = cert_id; |
| 327 entry->GetSSL().cert_status = ssl_info_.cert_status; | 329 entry->GetSSL().cert_status = ssl_info_.cert_status; |
| 328 entry->GetSSL().security_bits = ssl_info_.security_bits; | 330 entry->GetSSL().security_bits = ssl_info_.security_bits; |
| 329 content::NotificationService::current()->Notify( | 331 #if !defined(OS_ANDROID) |
| 330 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 332 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
| 331 content::Source<NavigationController>(&web_contents_->GetController()), | 333 if (browser) |
| 332 content::NotificationService::NoDetails()); | 334 browser->VisibleSSLStateChanged(web_contents_); |
| 335 #endif // !defined(OS_ANDROID) |
| 333 } | 336 } |
| 334 | 337 |
| 335 // Matches events defined in ssl_error.html and ssl_roadblock.html. | 338 // Matches events defined in ssl_error.html and ssl_roadblock.html. |
| 336 void SSLBlockingPage::CommandReceived(const std::string& command) { | 339 void SSLBlockingPage::CommandReceived(const std::string& command) { |
| 337 int cmd = atoi(command.c_str()); | 340 int cmd = atoi(command.c_str()); |
| 338 if (cmd == CMD_DONT_PROCEED) { | 341 if (cmd == CMD_DONT_PROCEED) { |
| 339 interstitial_page_->DontProceed(); | 342 interstitial_page_->DontProceed(); |
| 340 } else if (cmd == CMD_PROCEED) { | 343 } else if (cmd == CMD_PROCEED) { |
| 341 interstitial_page_->Proceed(); | 344 interstitial_page_->Proceed(); |
| 342 } else if (cmd == CMD_FOCUS) { | 345 } else if (cmd == CMD_FOCUS) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" | 401 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" |
| 399 }; | 402 }; |
| 400 int i; | 403 int i; |
| 401 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 404 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
| 402 strings->SetString(keys[i], extra_info[i]); | 405 strings->SetString(keys[i], extra_info[i]); |
| 403 } | 406 } |
| 404 for (; i < 5; i++) { | 407 for (; i < 5; i++) { |
| 405 strings->SetString(keys[i], ""); | 408 strings->SetString(keys[i], ""); |
| 406 } | 409 } |
| 407 } | 410 } |
| OLD | NEW |