Commit cbcd3c15 authored by dmazzoni's avatar dmazzoni Committed by Commit bot

Check in animation policy extension.

It's on the web store here:

https://chrome.google.com/webstore/detail/animation-policy/ncigbofjfbodhkaffojakplpmnleeoee

BUG=3690
NOTRY=true

Review URL: https://codereview.chromium.org/1109953003

Cr-Commit-Position: refs/heads/master@{#327563}
parent 35fbdd40
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
'type': 'none', 'type': 'none',
'dependencies': [ 'dependencies': [
'alt', 'alt',
'animation',
'caretbrowsing', 'caretbrowsing',
'colorenhancer', 'colorenhancer',
'highcontrast', 'highcontrast',
...@@ -64,6 +65,33 @@ ...@@ -64,6 +65,33 @@
}, },
], ],
}, },
{
'target_name': 'animation',
'type': 'none',
'copies': [
{
'destination': '<(dest_dir)/animation',
'files': [
'animation/manifest.json',
'animation/popup.html',
'animation/popup.js',
'animation/animation.png',
]
}
],
'actions': [
{
'action_name': 'animation_strings',
'variables': {
'grit_grd_file': 'strings/accessibility_extensions_strings.grd',
'grit_out_dir': '<(dest_dir)/animation',
# We don't generate any RC files, so no resource_ds file is needed.
'grit_resource_ids': '',
},
'includes': [ '../../../build/grit_action.gypi' ],
},
],
},
{ {
'target_name': 'caretbrowsing', 'target_name': 'caretbrowsing',
'type': 'none', 'type': 'none',
......
{
"name" : "__MSG_ANIMATION_APPNAME__",
"version" : "0.1",
"description" : "__MSG_ANIMATION_APPDESC__",
"permissions": [
"accessibilityFeatures.read",
"accessibilityFeatures.modify"
],
"browser_action": {
"default_icon": "animation.png",
"default_popup": "popup.html"
},
"manifest_version": 2,
"default_locale": "en"
}
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
width: 30em;
padding: 0.75em;
border-radius: 6px;
}
* {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
label {
display: block;
}
fieldset {
border: none;
margin: 0;
margin-bottom: 1em;
padding: 0;
}
legend {
font-size: 12pt;
font-weight: bold;
padding-top: 1em;
padding-bottom: 0.5em;
}
input[type="radio"] {
margin-left: 1em;
}
</style>
<script src="popup.js"></script>
</head>
<body>
<fieldset>
<legend id="title" i18n-content="animation_policy"></legend>
<label>
<input type="radio" name="animation" value="allowed">
<span i18n-content="animation_allowed"></span>
</label>
<label>
<input type="radio" name="animation" value="once">
<span i18n-content="animation_once"></span>
</label>
<label>
<input type="radio" name="animation" value="none">
<span i18n-content="animation_none"></span>
</label>
</fieldset>
</body>
</html>
// Copyright (c) 2015 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 animationPolicyChanged() {
if (this.checked) {
var type = this.id;
var setting = this.value;
console.log('set policy '+': '+setting);
chrome.accessibilityFeatures.animationPolicy.set(
{'value': setting}, function (callback) {});
}
}
function listener(data) {
console.log('animation policy is changed.');
}
function init() {
var i18nElements = document.querySelectorAll('*[i18n-content]');
for (var i = 0; i < i18nElements.length; i++) {
var elem = i18nElements[i];
var msg = elem.getAttribute('i18n-content');
elem.innerHTML = chrome.i18n.getMessage(msg);
}
chrome.accessibilityFeatures.animationPolicy.onChange.addListener(listener);
chrome.accessibilityFeatures.animationPolicy.get(
{'incognito': false}, function (policy) {
console.log('get policy '+': '+policy.value);
var selects = document.querySelectorAll('input');
for (var i = 0; i < selects.length; i++) {
if (selects[i].value == policy.value)
selects[i].checked = true;
}
});
var selects = document.querySelectorAll('input');
for (var i = 0; i < selects.length; i++) {
selects[i].addEventListener('change', animationPolicyChanged);
}
}
window.addEventListener('load', init, false);
...@@ -308,6 +308,27 @@ ...@@ -308,6 +308,27 @@
Setup Setup
</message> </message>
<!-- Animation extension -->
<message desc="The title of the extension that controls whether images can animate or not, displayed in the web store." name="IDS_ANIMATION_APPNAME">
Animation Policy
</message>
<message desc="The description of the extension that allows users to disable animations or run them only once." name="IDS_ANIMATION_APPDESC">
Run animations only once, or disable animation completely.
</message>
<message desc="The title of a group of radio buttons controlling the animation policy - whether animation is allowed, allowed once only, or disabled." name="IDS_ANIMATION_POLICY">
Animation Policy:
</message>
<message desc="Indicates that showing animated images is allowed" name="IDS_ANIMATION_ALLOWED">
Allow all animated images.
</message>
<message desc="Indicates that showing animated images should only happen one time" name="IDS_ANIMATION_ONCE">
Allow animated images, but only once.
</message>
<message desc="Indicates that there will be no image animation" name="IDS_ANIMATION_NONE">
Disable all image animation.
</message>
</messages> </messages>
</release> </release>
</grit> </grit>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment