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

Side by Side Diff: chrome/renderer/resources/extensions/context_menus_custom_bindings.js

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compilation Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Custom bindings for the contextMenus API. 5 // Custom binding for the contextMenus API.
6
7 var binding = require('binding').Binding.create('contextMenus');
6 8
7 var contextMenus = requireNative('context_menus'); 9 var contextMenus = requireNative('context_menus');
8 var GetNextContextMenuId = contextMenus.GetNextContextMenuId; 10 var GetNextContextMenuId = contextMenus.GetNextContextMenuId;
9 var sendRequest = require('sendRequest').sendRequest; 11 var sendRequest = require('sendRequest').sendRequest;
10 12
11 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 13 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
12 14
13 chromeHidden.registerCustomHook('contextMenus', function(bindingsAPI) { 15 binding.registerCustomHook(function(bindingsAPI) {
14 var apiFunctions = bindingsAPI.apiFunctions; 16 var apiFunctions = bindingsAPI.apiFunctions;
15 17
16 chromeHidden.contextMenus = {}; 18 chromeHidden.contextMenus = {};
17 chromeHidden.contextMenus.generatedIdHandlers = {}; 19 chromeHidden.contextMenus.generatedIdHandlers = {};
18 chromeHidden.contextMenus.stringIdHandlers = {}; 20 chromeHidden.contextMenus.stringIdHandlers = {};
19 var eventName = 'contextMenus'; 21 var eventName = 'contextMenus';
20 chromeHidden.contextMenus.event = new chrome.Event(eventName); 22 chromeHidden.contextMenus.event = new chrome.Event(eventName);
21 chromeHidden.contextMenus.getIdFromCreateProperties = function(prop) { 23 chromeHidden.contextMenus.getIdFromCreateProperties = function(prop) {
22 if (typeof(prop.id) !== 'undefined') 24 if (typeof(prop.id) !== 'undefined')
23 return prop.id; 25 return prop.id;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 93
92 apiFunctions.setCustomCallback('removeAll', 94 apiFunctions.setCustomCallback('removeAll',
93 function(name, request, response) { 95 function(name, request, response) {
94 if (chrome.runtime.lastError) { 96 if (chrome.runtime.lastError) {
95 return; 97 return;
96 } 98 }
97 chromeHidden.contextMenus.generatedIdHandlers = {}; 99 chromeHidden.contextMenus.generatedIdHandlers = {};
98 chromeHidden.contextMenus.stringIdHandlers = {}; 100 chromeHidden.contextMenus.stringIdHandlers = {};
99 }); 101 });
100 }); 102 });
103
104 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698