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

Unified Diff: ui/accessibility/extensions/longdesc/options.js

Issue 593293002: Initial checkin of accessibility extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix license issues Created 6 years, 3 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
« no previous file with comments | « ui/accessibility/extensions/longdesc/options.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/extensions/longdesc/options.js
diff --git a/ui/accessibility/extensions/longdesc/options.js b/ui/accessibility/extensions/longdesc/options.js
new file mode 100644
index 0000000000000000000000000000000000000000..d90d32b9b2b4833ecd795c5ce763965b65a2ac48
--- /dev/null
+++ b/ui/accessibility/extensions/longdesc/options.js
@@ -0,0 +1,30 @@
+/* Copyright (c) 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. */
+
+// Saves options to chrome.storage
+function save_options() {
+ var border = document.getElementById('border').checked;
+ chrome.storage.sync.set({
+ addBorder: border
+ }, function() {
+ // Update status to let user know options were saved.
+ var status = document.getElementById('status');
+ status.textContent = 'Options saved.';
+ setTimeout(function() {
+ status.textContent = '';
+ }, 750);
+ });
+}
+
+// Restores select box and checkbox state using the preferences
+// stored in chrome.storage.
+function restore_options() {
+ // Use default value addBOrder = false.
+ chrome.storage.sync.get("addBorder", function(item) {
+ document.getElementById('border').checked = item.addBorder;
+ });
+}
+
+document.addEventListener('DOMContentLoaded', restore_options);
+document.getElementById('border').addEventListener('click', save_options);
« no previous file with comments | « ui/accessibility/extensions/longdesc/options.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698