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

Side by Side Diff: ui/accessibility/extensions/animation/popup.js

Issue 1109953003: Check in animation policy extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_versions
Patch Set: Created 5 years, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2015 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 function animationPolicyChanged() {
6 if (this.checked) {
7 var type = this.id;
8 var setting = this.value;
9 console.log('set policy '+': '+setting);
je_julie(Not used) 2015/04/29 09:15:37 At the beginning, I added that to make sure whethe
dmazzoni 2015/04/29 20:06:16 It's okay. It will only show up in the popup backg
10 chrome.accessibilityFeatures.animationPolicy.set(
11 {'value': setting}, function (callback) {});
12 }
13 }
14
15 function listener(data) {
16 console.log('animation policy is changed.');
je_julie(Not used) 2015/04/29 09:15:37 ditto.
17 }
18
19 function init() {
20 var i18nElements = document.querySelectorAll('*[i18n-content]');
21 for (var i = 0; i < i18nElements.length; i++) {
22 var elem = i18nElements[i];
23 var msg = elem.getAttribute('i18n-content');
24 elem.innerHTML = chrome.i18n.getMessage(msg);
25 }
26
27 chrome.accessibilityFeatures.animationPolicy.onChange.addListener(listener);
28 chrome.accessibilityFeatures.animationPolicy.get(
29 {'incognito': false}, function (policy) {
30 console.log('get policy '+': '+policy.value);
31 var selects = document.querySelectorAll('input');
32 for (var i = 0; i < selects.length; i++) {
33 if (selects[i].value == policy.value)
34 selects[i].checked = true;
35 }
36 });
37
38 var selects = document.querySelectorAll('input');
39 for (var i = 0; i < selects.length; i++) {
40 selects[i].addEventListener('change', animationPolicyChanged);
41 }
42 }
43
44 window.addEventListener('load', init, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698