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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1000 // the rest of the API. See crbug/29215 . | 1000 // the rest of the API. See crbug/29215 . |
1001 if (arguments.length == 2 && typeof(arguments[1]) == "function") { | 1001 if (arguments.length == 2 && typeof(arguments[1]) == "function") { |
1002 // If the old signature is used, add a null details object. | 1002 // If the old signature is used, add a null details object. |
1003 newArgs = [arguments[0], null, arguments[1]]; | 1003 newArgs = [arguments[0], null, arguments[1]]; |
1004 } else { | 1004 } else { |
1005 newArgs = arguments; | 1005 newArgs = arguments; |
1006 } | 1006 } |
1007 return newArgs; | 1007 return newArgs; |
1008 }; | 1008 }; |
1009 | 1009 |
1010 apiFunctions["experimental.offscreenTabs.sendMouseEvent"]. | |
1011 updateArgumentsPreValidate = function() { | |
1012 // Delete properties that are objects in order to be able to serialize | |
1013 for (prop in arguments[1]) | |
1014 if (typeof arguments[1][prop] == "object") | |
1015 delete arguments[1][prop]; | |
1016 | |
1017 return arguments; | |
1018 }; | |
1019 | |
1020 apiFunctions["experimental.offscreenTabs.sendKeyboardEvent"]. | |
1021 updateArgumentsPreValidate = function() { | |
Ken Russell (switch to Gerrit)
2011/08/23 22:46:53
Actually, you can write this as: apiFunctions["exp
alexbost
2011/08/24 20:06:21
Done.
| |
1022 // Delete properties that are objects in order to be able to serialize | |
1023 for (prop in arguments[1]) | |
1024 if (typeof arguments[1][prop] == "object") | |
1025 delete arguments[1][prop]; | |
1026 | |
1027 return arguments; | |
1028 }; | |
1029 | |
1010 apiFunctions["omnibox.sendSuggestions"].updateArgumentsPostValidate = | 1030 apiFunctions["omnibox.sendSuggestions"].updateArgumentsPostValidate = |
1011 function(requestId, userSuggestions) { | 1031 function(requestId, userSuggestions) { |
1012 var suggestions = []; | 1032 var suggestions = []; |
1013 for (var i = 0; i < userSuggestions.length; i++) { | 1033 for (var i = 0; i < userSuggestions.length; i++) { |
1014 var parseResult = parseOmniboxDescription( | 1034 var parseResult = parseOmniboxDescription( |
1015 userSuggestions[i].description); | 1035 userSuggestions[i].description); |
1016 parseResult.content = userSuggestions[i].content; | 1036 parseResult.content = userSuggestions[i].content; |
1017 suggestions.push(parseResult); | 1037 suggestions.push(parseResult); |
1018 } | 1038 } |
1019 return [requestId, suggestions]; | 1039 return [requestId, suggestions]; |
(...skipping 29 matching lines...) Expand all Loading... | |
1049 | 1069 |
1050 if (!chrome.tts) | 1070 if (!chrome.tts) |
1051 chrome.tts = {}; | 1071 chrome.tts = {}; |
1052 | 1072 |
1053 if (!chrome.ttsEngine) | 1073 if (!chrome.ttsEngine) |
1054 chrome.ttsEngine = {}; | 1074 chrome.ttsEngine = {}; |
1055 | 1075 |
1056 if (!chrome.experimental.downloads) | 1076 if (!chrome.experimental.downloads) |
1057 chrome.experimental.downloads = {}; | 1077 chrome.experimental.downloads = {}; |
1058 })(); | 1078 })(); |
OLD | NEW |