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

Unified Diff: chrome/common/extensions/docs/examples/api/fontSettings/popup.js

Issue 9836036: Add getDefaultFontSize and setDefaultFontSize to Font Settings Extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch for landing Created 8 years, 9 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/common/extensions/docs/examples/api/fontSettings/popup.js
diff --git a/chrome/common/extensions/docs/examples/api/fontSettings/popup.js b/chrome/common/extensions/docs/examples/api/fontSettings/popup.js
index 14d6c5f888e01ecf4b720d4855430bfa6c226554..b8ec2eafea776af1def8489dff06b2773b7d4299 100644
--- a/chrome/common/extensions/docs/examples/api/fontSettings/popup.js
+++ b/chrome/common/extensions/docs/examples/api/fontSettings/popup.js
@@ -107,6 +107,16 @@ function updateListSelections() {
}
}
+function defaultFontSizeChanged() {
+ var defaultFontSizeInput = document.getElementById('defaultFontSize');
+ var pixelSize = parseInt(defaultFontSizeInput.value);
+ if (!isNaN(pixelSize)) {
+ chrome.experimental.fontSettings.setDefaultFontSize({
+ pixelSize: pixelSize
+ });
+ }
+}
+
function init() {
scriptList = document.getElementById('scriptList');
scriptList.addEventListener('change', updateListSelections);
@@ -120,6 +130,12 @@ function init() {
var handler = getFontChangeHandler(list, genericFamilies[i].name);
list.addEventListener('change', handler);
}
+
+ var defaultFontSizeInput = document.getElementById('defaultFontSize');
+ chrome.experimental.fontSettings.getDefaultFontSize({}, function(details) {
+ defaultFontSizeInput.value = details.pixelSize;
+ });
+ defaultFontSizeInput.addEventListener('change', defaultFontSizeChanged);
}
document.addEventListener('DOMContentLoaded', init);

Powered by Google App Engine
This is Rietveld 408576698