| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 // This script contains privileged chrome extension related javascript APIs. | 5 // This script contains privileged chrome extension related javascript APIs. |
| 6 // It is loaded by pages whose URL has the chrome-extension protocol. | 6 // It is loaded by pages whose URL has the chrome-extension protocol. |
| 7 | 7 |
| 8 var chrome = chrome || {}; | 8 var chrome = chrome || {}; |
| 9 (function() { | 9 (function() { |
| 10 native function GetExtensionAPIDefinition(); | 10 native function GetExtensionAPIDefinition(); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 return extendedSchema; | 344 return extendedSchema; |
| 345 } | 345 } |
| 346 | 346 |
| 347 var customBindings = {}; | 347 var customBindings = {}; |
| 348 | 348 |
| 349 function setupPreferences() { | 349 function setupPreferences() { |
| 350 customBindings['Preference'] = function(prefKey, valueSchema) { | 350 customBindings['Preference'] = function(prefKey, valueSchema) { |
| 351 this.getEffective = function(details, callback) { | 351 this.getEffective = function(details, callback) { |
| 352 var getSchema = this.parameters.getEffective; | 352 var getSchema = this.parameters.getEffective; |
| 353 chromeHidden.validate([details, callback], getSchema); | 353 chromeHidden.validate([details, callback], getSchema); |
| 354 return sendRequest('experimental.preferences.getEffective', | 354 return sendRequest('preferences.getEffective', |
| 355 [prefKey, details, callback], | 355 [prefKey, details, callback], |
| 356 extendSchema(getSchema)); | 356 extendSchema(getSchema)); |
| 357 }; | 357 }; |
| 358 this.set = function(details, callback) { | 358 this.set = function(details, callback) { |
| 359 var setSchema = this.parameters.set.slice(); | 359 var setSchema = this.parameters.set.slice(); |
| 360 setSchema[0].properties.value = valueSchema; | 360 setSchema[0].properties.value = valueSchema; |
| 361 chromeHidden.validate([details, callback], setSchema); | 361 chromeHidden.validate([details, callback], setSchema); |
| 362 return sendRequest('experimental.preferences.set', | 362 return sendRequest('preferences.set', |
| 363 [prefKey, details, callback], | 363 [prefKey, details, callback], |
| 364 extendSchema(setSchema)); | 364 extendSchema(setSchema)); |
| 365 }; | 365 }; |
| 366 this.clear = function(details, callback) { | 366 this.clear = function(details, callback) { |
| 367 var clearSchema = this.parameters.clear; | 367 var clearSchema = this.parameters.clear; |
| 368 chromeHidden.validate([details, callback], clearSchema); | 368 chromeHidden.validate([details, callback], clearSchema); |
| 369 return sendRequest('experimental.preferences.clear', | 369 return sendRequest('preferences.clear', |
| 370 [prefKey, details, callback], | 370 [prefKey, details, callback], |
| 371 extendSchema(clearSchema)); | 371 extendSchema(clearSchema)); |
| 372 }; | 372 }; |
| 373 this.onChangeEffective = new chrome.Event('experimental.preferences.' | 373 this.onChangeEffective = new chrome.Event('preferences.' |
| 374 + prefKey + '.onChangeEffective'); | 374 + prefKey + '.onChangeEffective'); |
| 375 }; | 375 }; |
| 376 customBindings['Preference'].prototype = new CustomBindingsObject(); | 376 customBindings['Preference'].prototype = new CustomBindingsObject(); |
| 377 } | 377 } |
| 378 | 378 |
| 379 // Page action events send (pageActionId, {tabId, tabUrl}). | 379 // Page action events send (pageActionId, {tabId, tabUrl}). |
| 380 function setupPageActionEvents(extensionId) { | 380 function setupPageActionEvents(extensionId) { |
| 381 var pageActions = GetCurrentPageActions(extensionId); | 381 var pageActions = GetCurrentPageActions(extensionId); |
| 382 | 382 |
| 383 var oldStyleEventName = "pageActions"; | 383 var oldStyleEventName = "pageActions"; |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 | 907 |
| 908 if (!chrome.experimental) | 908 if (!chrome.experimental) |
| 909 chrome.experimental = {}; | 909 chrome.experimental = {}; |
| 910 | 910 |
| 911 if (!chrome.experimental.accessibility) | 911 if (!chrome.experimental.accessibility) |
| 912 chrome.experimental.accessibility = {}; | 912 chrome.experimental.accessibility = {}; |
| 913 | 913 |
| 914 if (!chrome.experimental.tts) | 914 if (!chrome.experimental.tts) |
| 915 chrome.experimental.tts = {}; | 915 chrome.experimental.tts = {}; |
| 916 })(); | 916 })(); |
| OLD | NEW |