OLD | NEW |
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 var text = defaultStrings[this.controlledBy]; | 135 var text = defaultStrings[this.controlledBy]; |
136 if (this.controlledBy == 'extension' && this.extensionName) | 136 if (this.controlledBy == 'extension' && this.extensionName) |
137 text = defaultStrings.extensionWithName; | 137 text = defaultStrings.extensionWithName; |
138 | 138 |
139 // Apply text overrides. | 139 // Apply text overrides. |
140 if (this.hasAttribute('text' + this.controlledBy)) | 140 if (this.hasAttribute('text' + this.controlledBy)) |
141 text = this.getAttribute('text' + this.controlledBy); | 141 text = this.getAttribute('text' + this.controlledBy); |
142 | 142 |
143 // Create the DOM tree. | 143 // Create the DOM tree. |
144 var content = document.createElement('div'); | 144 var content = document.createElement('div'); |
| 145 content.classList.add('controlled-setting-bubble-header'); |
145 content.textContent = text; | 146 content.textContent = text; |
146 | 147 |
147 if (this.controlledBy == 'hasRecommendation' && this.resetHandler_ && | 148 if (this.controlledBy == 'hasRecommendation' && this.resetHandler_ && |
148 !this.readOnly) { | 149 !this.readOnly) { |
149 var container = document.createElement('div'); | 150 var container = document.createElement('div'); |
150 var action = document.createElement('button'); | 151 var action = document.createElement('button'); |
151 action.classList.add('link-button'); | 152 action.classList.add('link-button'); |
152 action.classList.add('controlled-setting-bubble-action'); | 153 action.classList.add('controlled-setting-bubble-action'); |
153 action.textContent = | 154 action.textContent = |
154 loadTimeData.getString('controlledSettingFollowRecommendation'); | 155 loadTimeData.getString('controlledSettingFollowRecommendation'); |
(...skipping 11 matching lines...) Expand all Loading... |
166 extensionContainer.hidden = false; | 167 extensionContainer.hidden = false; |
167 | 168 |
168 var extensionName = extensionContainer.querySelector( | 169 var extensionName = extensionContainer.querySelector( |
169 '.controlled-setting-bubble-extension-name'); | 170 '.controlled-setting-bubble-extension-name'); |
170 extensionName.textContent = this.extensionName; | 171 extensionName.textContent = this.extensionName; |
171 extensionName.style.backgroundImage = | 172 extensionName.style.backgroundImage = |
172 'url("' + this.extensionIcon + '")'; | 173 'url("' + this.extensionIcon + '")'; |
173 | 174 |
174 var manageLink = extensionContainer.querySelector( | 175 var manageLink = extensionContainer.querySelector( |
175 '.controlled-setting-bubble-extension-manage-link'); | 176 '.controlled-setting-bubble-extension-manage-link'); |
| 177 var extensionId = this.extensionId; |
176 manageLink.onclick = function() { | 178 manageLink.onclick = function() { |
177 uber.invokeMethodOnWindow( | 179 uber.invokeMethodOnWindow( |
178 window.top, 'showPage', {pageId: 'extensions'}); | 180 window.top, 'showPage', {pageId: 'extensions', |
| 181 path: '?id=' + extensionId}); |
179 }; | 182 }; |
180 | 183 |
181 var disableButton = extensionContainer.querySelector('button'); | 184 var disableButton = extensionContainer.querySelector('button'); |
182 var extensionId = this.extensionId; | |
183 disableButton.onclick = function() { | 185 disableButton.onclick = function() { |
184 chrome.send('disableExtension', [extensionId]); | 186 chrome.send('disableExtension', [extensionId]); |
185 }; | 187 }; |
186 content.appendChild(extensionContainer); | 188 content.appendChild(extensionContainer); |
187 } | 189 } |
188 | 190 |
189 OptionsPage.showBubble(content, this.image, this, this.location); | 191 OptionsPage.showBubble(content, this.image, this, this.location); |
190 } | 192 } |
191 }, | 193 }, |
192 }; | 194 }; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 * @type {string} | 237 * @type {string} |
236 */ | 238 */ |
237 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', | 239 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', |
238 cr.PropertyKind.ATTR); | 240 cr.PropertyKind.ATTR); |
239 | 241 |
240 // Export. | 242 // Export. |
241 return { | 243 return { |
242 ControlledSettingIndicator: ControlledSettingIndicator | 244 ControlledSettingIndicator: ControlledSettingIndicator |
243 }; | 245 }; |
244 }); | 246 }); |
OLD | NEW |