Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4788)

Unified Diff: chrome/browser/resources/ssl/captive_portal.js

Issue 318213002: Add custom interstitial for captive portals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Const all the things Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/ssl/captive_portal.js
diff --git a/chrome/browser/resources/ssl/captive_portal.js b/chrome/browser/resources/ssl/captive_portal.js
new file mode 100644
index 0000000000000000000000000000000000000000..8043e7a32974f11fdb3eb9a21b360631050e9bfb
--- /dev/null
+++ b/chrome/browser/resources/ssl/captive_portal.js
@@ -0,0 +1,33 @@
+// Copyright 2014 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.
+
+var expandedDetails = false;
+var CMD_OPEN_LOGIN_PAGE = 1;
+var CMD_SHOW_DETAILS = 2;
+
+function sendCommand(cmd) {
+ window.domAutomationController.setAutomationId(1);
+ window.domAutomationController.send(cmd);
+}
+
+function setupEvents() {
+ $('primary-button').addEventListener('click', function() {
+ sendCommand(CMD_OPEN_LOGIN_PAGE);
+ });
+
+ $('details-button').addEventListener('click', function(event) {
+ var hiddenDetails = $('details').classList.toggle('hidden');
+ $('details-button').innerText = hiddenDetails ?
+ loadTimeData.getString('openDetails') :
+ loadTimeData.getString('closeDetails');
+ if (!expandedDetails) {
+ // Record a histogram entry only the first time that details is opened.
+ sendCommand(CMD_SHOW_DETAILS);
+ expandedDetails = true;
+ }
+ event.preventDefault();
+ });
+}
+
+document.addEventListener('DOMContentLoaded', setupEvents);

Powered by Google App Engine
This is Rietveld 408576698