Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / ui / login / login_interstitial_delegate.cc
blobbd487559a52b9b1eb6cdf8806476d17f18222f85
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,
19 true,
20 request_url,
21 this);
22 interstitial_page->Show();
25 LoginInterstitialDelegate::~LoginInterstitialDelegate() {
28 void LoginInterstitialDelegate::CommandReceived(const std::string& command) {
29 callback_.Run();
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.
42 return std::string(
43 "<!DOCTYPE html>"
44 "<html><body><script>"
45 "window.domAutomationController.setAutomationId(1);"
46 "window.domAutomationController.send('1');"
47 "</script></body></html>");