| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/login/login_interstitial_delegate.h" | 5 #include "chrome/browser/ui/login/login_interstitial_delegate.h" |
| 6 #include "content/public/browser/navigation_entry.h" |
| 7 #include "content/public/common/ssl_status.h" |
| 6 | 8 |
| 7 content::InterstitialPageDelegate::TypeID | 9 content::InterstitialPageDelegate::TypeID |
| 8 LoginInterstitialDelegate::kTypeForTesting = | 10 LoginInterstitialDelegate::kTypeForTesting = |
| 9 &LoginInterstitialDelegate::kTypeForTesting; | 11 &LoginInterstitialDelegate::kTypeForTesting; |
| 10 | 12 |
| 11 LoginInterstitialDelegate::LoginInterstitialDelegate( | 13 LoginInterstitialDelegate::LoginInterstitialDelegate( |
| 12 content::WebContents* web_contents, | 14 content::WebContents* web_contents, |
| 13 const GURL& request_url, | 15 const GURL& request_url, |
| 16 const content::SSLStatus& ssl_status, |
| 14 base::Closure& callback) | 17 base::Closure& callback) |
| 15 : callback_(callback) { | 18 : web_contents_(web_contents), |
| 19 ssl_status_(ssl_status), |
| 20 callback_(callback) { |
| 16 // The interstitial page owns us. | 21 // The interstitial page owns us. |
| 17 content::InterstitialPage* interstitial_page = | 22 content::InterstitialPage* interstitial_page = |
| 18 content::InterstitialPage::Create(web_contents, | 23 content::InterstitialPage::Create(web_contents, |
| 19 true, | 24 true, |
| 20 request_url, | 25 request_url, |
| 21 this); | 26 this); |
| 22 interstitial_page->Show(); | 27 interstitial_page->Show(); |
| 23 } | 28 } |
| 24 | 29 |
| 25 LoginInterstitialDelegate::~LoginInterstitialDelegate() { | 30 LoginInterstitialDelegate::~LoginInterstitialDelegate() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 // closes all modal dialogs on the page. Therefore the login prompt must be | 44 // closes all modal dialogs on the page. Therefore the login prompt must be |
| 40 // shown after the interstitial is displayed. This is done by sending a | 45 // shown after the interstitial is displayed. This is done by sending a |
| 41 // command from the interstitial page as soon as it is loaded. | 46 // command from the interstitial page as soon as it is loaded. |
| 42 return std::string( | 47 return std::string( |
| 43 "<!DOCTYPE html>" | 48 "<!DOCTYPE html>" |
| 44 "<html><body><script>" | 49 "<html><body><script>" |
| 45 "window.domAutomationController.setAutomationId(1);" | 50 "window.domAutomationController.setAutomationId(1);" |
| 46 "window.domAutomationController.send('1');" | 51 "window.domAutomationController.send('1');" |
| 47 "</script></body></html>"); | 52 "</script></body></html>"); |
| 48 } | 53 } |
| 54 |
| 55 void LoginInterstitialDelegate::OverrideEntry(content::NavigationEntry* entry) { |
| 56 entry->GetSSL().security_style = ssl_status_.security_style; |
| 57 entry->GetSSL().cert_id = ssl_status_.cert_id; |
| 58 entry->GetSSL().cert_status = ssl_status_.cert_status; |
| 59 entry->GetSSL().security_bits = ssl_status_.security_bits; |
| 60 entry->GetSSL().connection_status = ssl_status_.connection_status; |
| 61 entry->GetSSL().content_status = ssl_status_.content_status; |
| 62 entry->GetSSL().signed_certificate_timestamp_ids = |
| 63 ssl_status_.signed_certificate_timestamp_ids; |
| 64 } |
| OLD | NEW |