| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 'contentSettings.getResourceIdentifiers', | 376 'contentSettings.getResourceIdentifiers', |
| 377 [contentType, callback], | 377 [contentType, callback], |
| 378 extendSchema(schema)); | 378 extendSchema(schema)); |
| 379 }; | 379 }; |
| 380 } | 380 } |
| 381 ContentSetting.prototype = new CustomBindingsObject(); | 381 ContentSetting.prototype = new CustomBindingsObject(); |
| 382 customBindings['ContentSetting'] = ContentSetting; | 382 customBindings['ContentSetting'] = ContentSetting; |
| 383 } | 383 } |
| 384 | 384 |
| 385 function setupInputEvents() { | 385 function setupInputEvents() { |
| 386 chrome.experimental.input.onKeyEvent.dispatch = | 386 chrome.experimental.input.ime.onKeyEvent.dispatch = |
| 387 function(engineID, keyData) { | 387 function(engineID, keyData) { |
| 388 var args = Array.prototype.slice.call(arguments); | 388 var args = Array.prototype.slice.call(arguments); |
| 389 if (this.validate_) { | 389 if (this.validate_) { |
| 390 var validationErrors = this.validate_(args); | 390 var validationErrors = this.validate_(args); |
| 391 if (validationErrors) { | 391 if (validationErrors) { |
| 392 chrome.experimental.input.eventHandled(requestId, false); | 392 chrome.experimental.input.ime.eventHandled(requestId, false); |
| 393 return validationErrors; | 393 return validationErrors; |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 if (this.listeners_.length > 1) { | 396 if (this.listeners_.length > 1) { |
| 397 console.error("Too many listeners for 'onKeyEvent': " + e.stack); | 397 console.error("Too many listeners for 'onKeyEvent': " + e.stack); |
| 398 chrome.experimental.input.eventHandled(requestId, false); | 398 chrome.experimental.input.ime.eventHandled(requestId, false); |
| 399 return; | 399 return; |
| 400 } | 400 } |
| 401 for (var i = 0; i < this.listeners_.length; i++) { | 401 for (var i = 0; i < this.listeners_.length; i++) { |
| 402 try { | 402 try { |
| 403 var requestId = keyData.requestId; | 403 var requestId = keyData.requestId; |
| 404 var result = this.listeners_[i].apply(null, args); | 404 var result = this.listeners_[i].apply(null, args); |
| 405 chrome.experimental.input.eventHandled(requestId, result); | 405 chrome.experimental.input.ime.eventHandled(requestId, result); |
| 406 } catch (e) { | 406 } catch (e) { |
| 407 console.error("Error in event handler for 'onKeyEvent': " + e.stack); | 407 console.error("Error in event handler for 'onKeyEvent': " + e.stack); |
| 408 chrome.experimental.input.eventHandled(requestId, false); | 408 chrome.experimental.input.ime.eventHandled(requestId, false); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 }; | 411 }; |
| 412 } | 412 } |
| 413 | 413 |
| 414 // Page action events send (pageActionId, {tabId, tabUrl}). | 414 // Page action events send (pageActionId, {tabId, tabUrl}). |
| 415 function setupPageActionEvents(extensionId) { | 415 function setupPageActionEvents(extensionId) { |
| 416 var pageActions = GetCurrentPageActions(extensionId); | 416 var pageActions = GetCurrentPageActions(extensionId); |
| 417 | 417 |
| 418 var oldStyleEventName = "pageActions"; | 418 var oldStyleEventName = "pageActions"; |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 | 1078 |
| 1079 if (!chrome.tts) | 1079 if (!chrome.tts) |
| 1080 chrome.tts = {}; | 1080 chrome.tts = {}; |
| 1081 | 1081 |
| 1082 if (!chrome.ttsEngine) | 1082 if (!chrome.ttsEngine) |
| 1083 chrome.ttsEngine = {}; | 1083 chrome.ttsEngine = {}; |
| 1084 | 1084 |
| 1085 if (!chrome.experimental.downloads) | 1085 if (!chrome.experimental.downloads) |
| 1086 chrome.experimental.downloads = {}; | 1086 chrome.experimental.downloads = {}; |
| 1087 })(); | 1087 })(); |
| OLD | NEW |