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

Side by Side Diff: chrome/browser/resources/safe_browsing/malware_block_v2.js

Issue 445493002: Delete the Safe Browsing V2 interstitial and Finch trial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing binary files Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 /**
6 * Sends a command message to SafeBrowsingBlockingPage::CommandReceived.
7 * @param {string} cmd The command to send.
8 */
9 function sendCommand(cmd) {
10 window.domAutomationController.setAutomationId(1);
11 window.domAutomationController.send(cmd);
12 }
13
14 /**
15 * Records state of the reporting checkbox.
16 */
17 function savePreference() {
18 var checkBox = $('check-report');
19 if (checkBox.checked)
20 sendCommand('doReport');
21 else
22 sendCommand('dontReport');
23 }
24
25 /**
26 * Expands or collapses the "see more" section of the page.
27 */
28 function seeMore() {
29 if ($('see-less-text').hidden) {
30 $('see-more-text').hidden = true;
31 $('see-less-text').hidden = false;
32 $('see-more-contents').hidden = false;
33 sendCommand('expandedSeeMore');
34 } else {
35 $('see-more-text').hidden = false;
36 $('see-less-text').hidden = true;
37 $('see-more-contents').hidden = true;
38 }
39 }
40
41 /* This sets up 4 conditions for the Field Trial.
42 * The 'NoBrand' conditions don't have the Chrome/Chromium logo at the top.
43 * The 'OneStep' conditions don't hide the proceed button.
44 */
45 function setupInterstitialExperiment() {
46 var condition = templateData.trialType;
47 if (condition == 'cond2MalwareNoBrand' ||
48 condition == 'cond4PhishingNoBrand') {
49 $('logo').style.display = 'none';
50 } else if (condition == 'cond5MalwareOneStep' ||
51 condition == 'cond6PhishingOneStep') {
52 $('see-more-contents').hidden = false;
53 $('see-less-text').hidden = true;
54 $('see-more-text').hidden = true;
55 }
56 }
57
58 /**
59 * Onload listener to initialize javascript handlers.
60 */
61 document.addEventListener('DOMContentLoaded', function() {
62 $('proceed-span').hidden = templateData.proceedDisabled;
63
64 $('back').onclick = function() {
65 sendCommand('takeMeBack');
66 };
67 $('proceed').onclick = function(e) {
68 sendCommand('proceed');
69 };
70 $('learn-more-link').onclick = function(e) {
71 sendCommand('learnMore2');
72 };
73 $('show-diagnostic-link').onclick = function(e) {
74 sendCommand('showDiagnostic');
75 };
76 $('report-error-link').onclick = function(e) {
77 sendCommand('reportError');
78 };
79 $('see-more-link').onclick = function(e) {
80 seeMore();
81 // preventDefaultOnPoundLinkClicks doesn't work for this link since it
82 // contains <span>s, which confuse preventDefaultOnPoundLinkClicks.
83 e.preventDefault();
84 };
85 $('check-report').onclick = savePreference;
86
87 // All the links are handled by javascript sending commands back to the C++
88 // handler, we don't want the default actions.
89 preventDefaultOnPoundLinkClicks(); // From webui/js/util.js.
90
91 setupInterstitialExperiment();
92
93 // Allow jsdisplay elements to be visible now.
94 document.documentElement.classList.remove('loading');
95 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698