| 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 // ----------------------------------------------------------------------------- | 5 // ----------------------------------------------------------------------------- |
| 6 // NOTE: If you change this file you need to touch renderer_resources.grd to | 6 // NOTE: If you change this file you need to touch renderer_resources.grd to |
| 7 // have your change take effect. | 7 // have your change take effect. |
| 8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
| 9 | 9 |
| 10 // This script contains privileged chrome extension related javascript APIs. | 10 // This script contains privileged chrome extension related javascript APIs. |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 function setupPageActionEvents(extensionId) { | 186 function setupPageActionEvents(extensionId) { |
| 187 var pageActions = GetCurrentPageActions(extensionId); | 187 var pageActions = GetCurrentPageActions(extensionId); |
| 188 var eventName = ""; | 188 var eventName = ""; |
| 189 for (var i = 0; i < pageActions.length; ++i) { | 189 for (var i = 0; i < pageActions.length; ++i) { |
| 190 eventName = extensionId + "/" + pageActions[i]; | 190 eventName = extensionId + "/" + pageActions[i]; |
| 191 // Setup events for each extension_id/page_action_id string we find. | 191 // Setup events for each extension_id/page_action_id string we find. |
| 192 chrome.pageActions[pageActions[i]] = new chrome.Event(eventName); | 192 chrome.pageActions[pageActions[i]] = new chrome.Event(eventName); |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 // Browser action events send {windowpId}. |
| 197 function setupBrowserActionEvent(extensionId) { |
| 198 var eventName = "browserAction/" + extensionId; |
| 199 chrome.browserAction = chrome.browserAction || {}; |
| 200 chrome.browserAction.onClicked = new chrome.Event(eventName); |
| 201 } |
| 202 |
| 196 function setupToolstripEvents(renderViewId) { | 203 function setupToolstripEvents(renderViewId) { |
| 197 chrome.toolstrip = chrome.toolstrip || {}; | 204 chrome.toolstrip = chrome.toolstrip || {}; |
| 198 chrome.toolstrip.onExpanded = | 205 chrome.toolstrip.onExpanded = |
| 199 new chrome.Event("toolstrip.onExpanded." + renderViewId); | 206 new chrome.Event("toolstrip.onExpanded." + renderViewId); |
| 200 chrome.toolstrip.onCollapsed = | 207 chrome.toolstrip.onCollapsed = |
| 201 new chrome.Event("toolstrip.onCollapsed." + renderViewId); | 208 new chrome.Event("toolstrip.onCollapsed." + renderViewId); |
| 202 } | 209 } |
| 203 | 210 |
| 204 chromeHidden.onLoad.addListener(function (extensionId) { | 211 chromeHidden.onLoad.addListener(function (extensionId) { |
| 205 chrome.extension = new chrome.Extension(extensionId); | 212 chrome.extension = new chrome.Extension(extensionId); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 functions.forEach(function(name) { | 317 functions.forEach(function(name) { |
| 311 // Event disambiguation is handled by name munging. See | 318 // Event disambiguation is handled by name munging. See |
| 312 // chrome/browser/extensions/extension_devtools_events.h for the C++ | 319 // chrome/browser/extensions/extension_devtools_events.h for the C++ |
| 313 // equivalent of this logic. | 320 // equivalent of this logic. |
| 314 tabIdProxy[name] = new chrome.Event("devtools." + tabId + "." + name); | 321 tabIdProxy[name] = new chrome.Event("devtools." + tabId + "." + name); |
| 315 }); | 322 }); |
| 316 return tabIdProxy; | 323 return tabIdProxy; |
| 317 } | 324 } |
| 318 | 325 |
| 319 setupPageActionEvents(extensionId); | 326 setupPageActionEvents(extensionId); |
| 327 setupBrowserActionEvent(extensionId); |
| 320 setupToolstripEvents(GetRenderViewId()); | 328 setupToolstripEvents(GetRenderViewId()); |
| 321 }); | 329 }); |
| 322 })(); | 330 })(); |
| OLD | NEW |