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

Side by Side Diff: chrome/browser/resources/options/font_settings_ui.js

Issue 6577029: web-ui settings: Explicitly set preferences for sans-serif font and minimum l... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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) 2011 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 cr.define('options', function() {
6
7 /////////////////////////////////////////////////////////////////////////////
8 // MinimumFontSizeSelect class:
9
10 // Define a constructor that uses a select element as its underlying element.
11 var MinimumFontSizeSelect = cr.ui.define('select');
12
13 MinimumFontSizeSelect.prototype = {
14 __proto__: HTMLSelectElement.prototype,
15
16 /** @inheritDoc */
17 decorate: function() {
18 var self = this;
19
20 // Listen to pref changes.
21 Preferences.getInstance().addEventListener(
22 'webkit.webprefs.minimum_font_size', function(event) {
23 var value = (event.value && event.value['value'] != undefined)
24 ? event.value['value'] : event.value;
25 self.managed = (event.value && event.value['managed'] != undefined)
26 ? event.value['managed'] : false;
27 self.disabled = self.managed;
28 for (var i = 0; i < self.options.length; i++) {
29 if (self.options[i].value == value) {
30 self.selectedIndex = i;
31 return;
32 }
33 }
34 // Item not found, select first item.
35 self.selectedIndex = 0;
36 });
37
38 // Listen to user events.
39 this.addEventListener('change',
40 function(e) {
41 if (self.options[self.selectedIndex].value > 0) {
42 Preferences.setIntegerPref(
43 'webkit.webprefs.minimum_font_size',
44 self.options[self.selectedIndex].value,
45 'Options_ChangeMinimumFontSize');
46 Preferences.setIntegerPref(
47 'webkit.webprefs.minimum_logical_font_size',
48 self.options[self.selectedIndex].value, '');
49 } else {
50 Preferences.clearPref(
51 'webkit.webprefs.minimum_font_size',
52 'Options_ChangeMinimumFontSize');
53 Preferences.clearPref(
54 'webkit.webprefs.minimum_logical_font_size', '');
55 }
56 });
57 },
58 };
59
60 // Export
61 return {
62 MinimumFontSizeSelect: MinimumFontSizeSelect
63 };
64
65 });
66
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/font_settings.js ('k') | chrome/browser/resources/options/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698