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

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

Issue 2840038: Move context menu module out of experimental. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: kathy changes Created 10 years, 5 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 apiFunctions["browserAction.setIcon"].handleRequest = function(details) { 594 apiFunctions["browserAction.setIcon"].handleRequest = function(details) {
595 setIconCommon( 595 setIconCommon(
596 details, this.name, this.definition.parameters, "browser action"); 596 details, this.name, this.definition.parameters, "browser action");
597 }; 597 };
598 598
599 apiFunctions["pageAction.setIcon"].handleRequest = function(details) { 599 apiFunctions["pageAction.setIcon"].handleRequest = function(details) {
600 setIconCommon( 600 setIconCommon(
601 details, this.name, this.definition.parameters, "page action"); 601 details, this.name, this.definition.parameters, "page action");
602 }; 602 };
603 603
604 apiFunctions["experimental.contextMenus.create"].handleRequest = 604 apiFunctions["contextMenus.create"].handleRequest =
605 function() { 605 function() {
606 var args = arguments; 606 var args = arguments;
607 var id = chromeHidden.contextMenus.nextId++; 607 var id = chromeHidden.contextMenus.nextId++;
608 args[0].generatedId = id; 608 args[0].generatedId = id;
609 sendRequest(this.name, args, this.definition.parameters, 609 sendRequest(this.name, args, this.definition.parameters,
610 this.customCallback); 610 this.customCallback);
611 return id; 611 return id;
612 }; 612 };
613 613
614 apiFunctions["experimental.contextMenus.create"].customCallback = 614 apiFunctions["contextMenus.create"].customCallback =
615 function(name, request, response) { 615 function(name, request, response) {
616 if (chrome.extension.lastError) { 616 if (chrome.extension.lastError) {
617 return; 617 return;
618 } 618 }
619 619
620 var id = request.args[0].generatedId; 620 var id = request.args[0].generatedId;
621 621
622 // Set up the onclick handler if we were passed one in the request. 622 // Set up the onclick handler if we were passed one in the request.
623 var onclick = request.args.length ? request.args[0].onclick : null; 623 var onclick = request.args.length ? request.args[0].onclick : null;
624 if (onclick) { 624 if (onclick) {
625 chromeHidden.contextMenus.ensureListenerSetup(); 625 chromeHidden.contextMenus.ensureListenerSetup();
626 chromeHidden.contextMenus.handlers[id] = onclick; 626 chromeHidden.contextMenus.handlers[id] = onclick;
627 } 627 }
628 }; 628 };
629 629
630 apiFunctions["experimental.contextMenus.remove"].customCallback = 630 apiFunctions["contextMenus.remove"].customCallback =
631 function(name, request, response) { 631 function(name, request, response) {
632 if (chrome.extension.lastError) { 632 if (chrome.extension.lastError) {
633 return; 633 return;
634 } 634 }
635 var id = request.args[0]; 635 var id = request.args[0];
636 delete chromeHidden.contextMenus.handlers[id]; 636 delete chromeHidden.contextMenus.handlers[id];
637 }; 637 };
638 638
639 apiFunctions["experimental.contextMenus.update"].customCallback = 639 apiFunctions["contextMenus.update"].customCallback =
640 function(name, request, response) { 640 function(name, request, response) {
641 if (chrome.extension.lastError) { 641 if (chrome.extension.lastError) {
642 return; 642 return;
643 } 643 }
644 var id = request.args[0]; 644 var id = request.args[0];
645 if (request.args[1].onclick) { 645 if (request.args[1].onclick) {
646 chromeHidden.contextMenus.handlers[id] = request.args[1].onclick; 646 chromeHidden.contextMenus.handlers[id] = request.args[1].onclick;
647 } 647 }
648 }; 648 };
649 649
650 apiFunctions["experimental.contextMenus.removeAll"].customCallback = 650 apiFunctions["contextMenus.removeAll"].customCallback =
651 function(name, request, response) { 651 function(name, request, response) {
652 if (chrome.extension.lastError) { 652 if (chrome.extension.lastError) {
653 return; 653 return;
654 } 654 }
655 chromeHidden.contextMenus.handlers = {}; 655 chromeHidden.contextMenus.handlers = {};
656 }; 656 };
657 657
658 apiFunctions["tabs.captureVisibleTab"].updateArguments = function() { 658 apiFunctions["tabs.captureVisibleTab"].updateArguments = function() {
659 // Old signature: 659 // Old signature:
660 // captureVisibleTab(int windowId, function callback); 660 // captureVisibleTab(int windowId, function callback);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 setupHiddenContextMenuEvent(extensionId); 701 setupHiddenContextMenuEvent(extensionId);
702 setupOmniboxEvents(extensionId); 702 setupOmniboxEvents(extensionId);
703 }); 703 });
704 704
705 if (!chrome.experimental) 705 if (!chrome.experimental)
706 chrome.experimental = {}; 706 chrome.experimental = {};
707 707
708 if (!chrome.experimental.accessibility) 708 if (!chrome.experimental.accessibility)
709 chrome.experimental.accessibility = {}; 709 chrome.experimental.accessibility = {};
710 })(); 710 })();
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_process_bindings.cc ('k') | chrome/renderer/resources/renderer_extension_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698