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 LoginInterstitialDelegate::LoginInterstitialDelegate(
8 content::WebContents
* web_contents
,
9 const GURL
& request_url
,
10 base::Closure
& callback
)
11 : callback_(callback
) {
12 // The interstitial page owns us.
13 content::InterstitialPage
* interstitial_page
=
14 content::InterstitialPage::Create(web_contents
,
18 interstitial_page
->Show();
21 LoginInterstitialDelegate::~LoginInterstitialDelegate() {
24 void LoginInterstitialDelegate::CommandReceived(const std::string
& command
) {
28 std::string
LoginInterstitialDelegate::GetHTMLContents() {
29 // Showing an interstitial results in a new navigation, and a new navigation
30 // closes all modal dialogs on the page. Therefore the login prompt must be
31 // shown after the interstitial is displayed. This is done by sending a
32 // command from the interstitial page as soon as it is loaded.
35 "<html><body><script>"
36 "window.domAutomationController.setAutomationId(1);"
37 "window.domAutomationController.send('1');"
38 "</script></body></html>");