| OLD | NEW |
| 1 // Copyright (c) 2009 The chrome Authors. All rights reserved. | 1 // Copyright (c) 2009 The chrome 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // Module events may have been defined earlier by hand. Don't clobber | 275 // Module events may have been defined earlier by hand. Don't clobber |
| 276 // them. | 276 // them. |
| 277 if (module[eventDef.name]) | 277 if (module[eventDef.name]) |
| 278 return; | 278 return; |
| 279 | 279 |
| 280 var eventName = apiDef.namespace + "." + eventDef.name; | 280 var eventName = apiDef.namespace + "." + eventDef.name; |
| 281 module[eventDef.name] = new chrome.Event(eventName, | 281 module[eventDef.name] = new chrome.Event(eventName, |
| 282 eventDef.parameters); | 282 eventDef.parameters); |
| 283 }); | 283 }); |
| 284 } | 284 } |
| 285 |
| 286 |
| 287 // getTabContentses is retained for backwards compatibility |
| 288 // See http://crbug.com/21433 |
| 289 chrome.extension.getTabContentses = chrome.extension.getExtensionTabs |
| 285 }); | 290 }); |
| 286 | 291 |
| 287 apiFunctions["tabs.connect"].handleRequest = function(tabId, connectInfo) { | 292 apiFunctions["tabs.connect"].handleRequest = function(tabId, connectInfo) { |
| 288 var name = ""; | 293 var name = ""; |
| 289 if (connectInfo) { | 294 if (connectInfo) { |
| 290 name = connectInfo.name || name; | 295 name = connectInfo.name || name; |
| 291 } | 296 } |
| 292 var portId = OpenChannelToTab( | 297 var portId = OpenChannelToTab( |
| 293 tabId, chromeHidden.extensionId, name); | 298 tabId, chromeHidden.extensionId, name); |
| 294 return chromeHidden.Port.createPort(portId, name); | 299 return chromeHidden.Port.createPort(portId, name); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 314 return GetExtensionViews(-1, "BACKGROUND")[0] || null; | 319 return GetExtensionViews(-1, "BACKGROUND")[0] || null; |
| 315 } | 320 } |
| 316 | 321 |
| 317 apiFunctions["extension.getToolstrips"].handleRequest = | 322 apiFunctions["extension.getToolstrips"].handleRequest = |
| 318 function(windowId) { | 323 function(windowId) { |
| 319 if (typeof(windowId) == "undefined") | 324 if (typeof(windowId) == "undefined") |
| 320 windowId = -1; | 325 windowId = -1; |
| 321 return GetExtensionViews(windowId, "TOOLSTRIP"); | 326 return GetExtensionViews(windowId, "TOOLSTRIP"); |
| 322 } | 327 } |
| 323 | 328 |
| 324 apiFunctions["extension.getTabContentses"].handleRequest = | 329 apiFunctions["extension.getExtensionTabs"].handleRequest = |
| 325 function(windowId) { | 330 function(windowId) { |
| 326 if (typeof(windowId) == "undefined") | 331 if (typeof(windowId) == "undefined") |
| 327 windowId = -1; | 332 windowId = -1; |
| 328 return GetExtensionViews(windowId, "TAB"); | 333 return GetExtensionViews(windowId, "TAB"); |
| 329 } | 334 } |
| 330 | 335 |
| 331 apiFunctions["devtools.getTabEvents"].handleRequest = function(tabId) { | 336 apiFunctions["devtools.getTabEvents"].handleRequest = function(tabId) { |
| 332 var tabIdProxy = {}; | 337 var tabIdProxy = {}; |
| 333 var functions = ["onPageEvent", "onTabClose"]; | 338 var functions = ["onPageEvent", "onTabClose"]; |
| 334 functions.forEach(function(name) { | 339 functions.forEach(function(name) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 400 |
| 396 apiFunctions["pageAction.setIcon"].handleRequest = function(details) { | 401 apiFunctions["pageAction.setIcon"].handleRequest = function(details) { |
| 397 setIconCommon(details, this.name, this.definition.parameters); | 402 setIconCommon(details, this.name, this.definition.parameters); |
| 398 }; | 403 }; |
| 399 | 404 |
| 400 setupBrowserActionEvent(extensionId); | 405 setupBrowserActionEvent(extensionId); |
| 401 setupPageActionEvents(extensionId); | 406 setupPageActionEvents(extensionId); |
| 402 setupToolstripEvents(GetRenderViewId()); | 407 setupToolstripEvents(GetRenderViewId()); |
| 403 }); | 408 }); |
| 404 })(); | 409 })(); |
| OLD | NEW |