Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1141)

Side by Side Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 203023: add mole collapse/expand events. convert mappy to use this. (Closed)
Patch Set: add missing file Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.
11 // It is loaded by pages whose URL has the chrome-extension protocol. 11 // It is loaded by pages whose URL has the chrome-extension protocol.
12 12
13 var chrome = chrome || {}; 13 var chrome = chrome || {};
14 (function() { 14 (function() {
15 native function GetExtensionAPIDefinition(); 15 native function GetExtensionAPIDefinition();
16 native function StartRequest(); 16 native function StartRequest();
17 native function GetCurrentPageActions(extensionId); 17 native function GetCurrentPageActions(extensionId);
18 native function GetExtensionViews(); 18 native function GetExtensionViews();
19 native function GetChromeHidden(); 19 native function GetChromeHidden();
20 native function GetNextRequestId(); 20 native function GetNextRequestId();
21 native function OpenChannelToTab(); 21 native function OpenChannelToTab();
22 native function GetRenderViewId();
22 23
23 if (!chrome) 24 if (!chrome)
24 chrome = {}; 25 chrome = {};
25 26
26 var chromeHidden = GetChromeHidden(); 27 var chromeHidden = GetChromeHidden();
27 28
28 // Validate arguments. 29 // Validate arguments.
29 chromeHidden.validationTypes = []; 30 chromeHidden.validationTypes = [];
30 chromeHidden.validate = function(args, schemas) { 31 chromeHidden.validate = function(args, schemas) {
31 if (args.length > schemas.length) 32 if (args.length > schemas.length)
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 function setupPageActionEvents(extensionId) { 176 function setupPageActionEvents(extensionId) {
176 var pageActions = GetCurrentPageActions(extensionId); 177 var pageActions = GetCurrentPageActions(extensionId);
177 var eventName = ""; 178 var eventName = "";
178 for (var i = 0; i < pageActions.length; ++i) { 179 for (var i = 0; i < pageActions.length; ++i) {
179 eventName = extensionId + "/" + pageActions[i]; 180 eventName = extensionId + "/" + pageActions[i];
180 // Setup events for each extension_id/page_action_id string we find. 181 // Setup events for each extension_id/page_action_id string we find.
181 chrome.pageActions[pageActions[i]] = new chrome.Event(eventName); 182 chrome.pageActions[pageActions[i]] = new chrome.Event(eventName);
182 } 183 }
183 } 184 }
184 185
186 function setupToolstripEvents(renderViewId) {
187 chrome.toolstrip = chrome.toolstrip || {};
188 chrome.toolstrip.onExpanded =
189 new chrome.Event("toolstrip.onExpanded." + renderViewId);
190 chrome.toolstrip.onCollapsed =
191 new chrome.Event("toolstrip.onCollapsed." + renderViewId);
192 }
193
185 chromeHidden.onLoad.addListener(function (extensionId) { 194 chromeHidden.onLoad.addListener(function (extensionId) {
186 chrome.extension = new chrome.Extension(extensionId); 195 chrome.extension = new chrome.Extension(extensionId);
187 196
188 // TODO(mpcomplete): chrome.self is deprecated. Remove it at 1.0. 197 // TODO(mpcomplete): chrome.self is deprecated. Remove it at 1.0.
189 // http://code.google.com/p/chromium/issues/detail?id=16356 198 // http://code.google.com/p/chromium/issues/detail?id=16356
190 chrome.self = chrome.extension; 199 chrome.self = chrome.extension;
191 200
192 // |apiFunctions| is a hash of name -> object that stores the 201 // |apiFunctions| is a hash of name -> object that stores the
193 // name & definition of the apiFunction. Custom handling of api functions 202 // name & definition of the apiFunction. Custom handling of api functions
194 // is implemented by adding a "handleRequest" function to the object. 203 // is implemented by adding a "handleRequest" function to the object.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 function(name) { 300 function(name) {
292 // Event disambiguation is handled by name munging. See 301 // Event disambiguation is handled by name munging. See
293 // chrome/browser/extensions/extension_devtools_events.h for the C++ 302 // chrome/browser/extensions/extension_devtools_events.h for the C++
294 // equivalent of this logic. 303 // equivalent of this logic.
295 tabIdProxy[name] = new chrome.Event("devtools." + tabId + "." + name); 304 tabIdProxy[name] = new chrome.Event("devtools." + tabId + "." + name);
296 }); 305 });
297 return tabIdProxy; 306 return tabIdProxy;
298 } 307 }
299 308
300 setupPageActionEvents(extensionId); 309 setupPageActionEvents(extensionId);
310 setupToolstripEvents(GetRenderViewId());
301 }); 311 });
302 })(); 312 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698