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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/login/login_interstitial_delegate.h"
7 content::InterstitialPageDelegate::TypeID
8 LoginInterstitialDelegate::kTypeForTesting
=
9 &LoginInterstitialDelegate::kTypeForTesting
;
11 LoginInterstitialDelegate::LoginInterstitialDelegate(
12 content::WebContents
* web_contents
,
13 const GURL
& request_url
,
14 base::Closure
& callback
)
15 : callback_(callback
) {
16 // The interstitial page owns us.
17 content::InterstitialPage
* interstitial_page
=
18 content::InterstitialPage::Create(web_contents
,
22 interstitial_page
->Show();
25 LoginInterstitialDelegate::~LoginInterstitialDelegate() {
28 void LoginInterstitialDelegate::CommandReceived(const std::string
& command
) {
32 content::InterstitialPageDelegate::TypeID
33 LoginInterstitialDelegate::GetTypeForTesting() const {
34 return LoginInterstitialDelegate::kTypeForTesting
;
37 std::string
LoginInterstitialDelegate::GetHTMLContents() {
38 // Showing an interstitial results in a new navigation, and a new navigation
39 // 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
41 // command from the interstitial page as soon as it is loaded.
44 "<html><body><script>"
45 "window.domAutomationController.setAutomationId(1);"
46 "window.domAutomationController.send('1');"
47 "</script></body></html>");