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

Side by Side Diff: chrome/browser/resources/options2/controlled_setting.js

Issue 10391044: retry 136193 - convert localStrings to loadTimeData for options page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 var Preferences = options.Preferences; 6 var Preferences = options.Preferences;
7 7
8 /** 8 /**
9 * A controlled setting indicator that can be placed on a setting as an 9 * A controlled setting indicator that can be placed on a setting as an
10 * indicator that the value is controlled by some external entity such as 10 * indicator that the value is controlled by some external entity such as
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Clear out the old bubble contents. 72 // Clear out the old bubble contents.
73 var bubbleContainer = this.querySelector('.controlled-setting-bubble'); 73 var bubbleContainer = this.querySelector('.controlled-setting-bubble');
74 if (bubbleContainer) { 74 if (bubbleContainer) {
75 while (bubbleContainer.hasChildNodes()) 75 while (bubbleContainer.hasChildNodes())
76 bubbleContainer.removeChild(bubbleContainer.lastChild); 76 bubbleContainer.removeChild(bubbleContainer.lastChild);
77 } 77 }
78 78
79 // Work out the bubble text. 79 // Work out the bubble text.
80 defaultStrings = { 80 defaultStrings = {
81 'policy' : localStrings.getString('controlledSettingPolicy'), 81 policy: loadTimeData.getString('controlledSettingPolicy'),
82 'extension' : localStrings.getString('controlledSettingExtension'), 82 extension: loadTimeData.getString('controlledSettingExtension'),
83 'recommended' : localStrings.getString('controlledSettingRecommended'), 83 recommended: loadTimeData.getString('controlledSettingRecommended'),
84 }; 84 };
85 85
86 // No controller, no bubble. 86 // No controller, no bubble.
87 if (!self.controlledBy || !self.controlledBy in defaultStrings) 87 if (!self.controlledBy || !self.controlledBy in defaultStrings)
88 return; 88 return;
89 89
90 var text = defaultStrings[self.controlledBy]; 90 var text = defaultStrings[self.controlledBy];
91 91
92 // Apply text overrides. 92 // Apply text overrides.
93 if (self.hasAttribute('text' + self.controlledBy)) 93 if (self.hasAttribute('text' + self.controlledBy))
94 text = self.getAttribute('text' + self.controlledBy); 94 text = self.getAttribute('text' + self.controlledBy);
95 95
96 // Create the DOM tree. 96 // Create the DOM tree.
97 var bubbleText = doc.createElement('p'); 97 var bubbleText = doc.createElement('p');
98 bubbleText.className = 'controlled-setting-bubble-text'; 98 bubbleText.className = 'controlled-setting-bubble-text';
99 bubbleText.textContent = text; 99 bubbleText.textContent = text;
100 100
101 var pref = self.getAttribute('pref'); 101 var pref = self.getAttribute('pref');
102 if (self.controlledBy == 'recommended' && pref) { 102 if (self.controlledBy == 'recommended' && pref) {
103 var container = doc.createElement('div'); 103 var container = doc.createElement('div');
104 var action = doc.createElement('button'); 104 var action = doc.createElement('button');
105 action.classList.add('link-button'); 105 action.classList.add('link-button');
106 action.classList.add('controlled-setting-bubble-action'); 106 action.classList.add('controlled-setting-bubble-action');
107 action.textContent = 107 action.textContent =
108 localStrings.getString('controlledSettingApplyRecommendation'); 108 loadTimeData.getString('controlledSettingApplyRecommendation');
109 action.addEventListener( 109 action.addEventListener(
110 'click', 110 'click',
111 function(e) { 111 function(e) {
112 Preferences.clearPref(pref); 112 Preferences.clearPref(pref);
113 }); 113 });
114 container.appendChild(action); 114 container.appendChild(action);
115 bubbleText.appendChild(container); 115 bubbleText.appendChild(container);
116 } 116 }
117 117
118 bubbleContainer.appendChild(bubbleText); 118 bubbleContainer.appendChild(bubbleText);
(...skipping 10 matching lines...) Expand all
129 */ 129 */
130 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', 130 cr.defineProperty(ControlledSettingIndicator, 'controlledBy',
131 cr.PropertyKind.ATTR, 131 cr.PropertyKind.ATTR,
132 ControlledSettingIndicator.prototype.close); 132 ControlledSettingIndicator.prototype.close);
133 133
134 // Export. 134 // Export.
135 return { 135 return {
136 ControlledSettingIndicator: ControlledSettingIndicator 136 ControlledSettingIndicator: ControlledSettingIndicator
137 }; 137 };
138 }); 138 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698