summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/managed_mode_block_interstitial.js
blob: 313ba6e23b551fa17e6fd26ed20d8ff40d716518 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

function sendCommand(cmd) {
  window.domAutomationController.setAutomationId(1);
  window.domAutomationController.send(cmd);
}

function initialize() {
  if (loadTimeData.getBoolean('allowAccessRequests')) {
    $('request-access-button').onclick = function(event) {
      updateAfterRequestSent();
      sendCommand('request');
    };
  } else {
    $('request-access-button').hidden = true;
  }
  $('back-button').onclick = function(event) {
    sendCommand('back');
  };
}

/**
 * Updates the interstitial to show that the request was sent.
 */
function updateAfterRequestSent() {
  $('error-img').hidden = true;
  $('request-access-button').hidden = true;
  $('block-page-message').hidden = true;
  $('request-sent-message').hidden = false;
}

document.addEventListener('DOMContentLoaded', initialize);