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