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

Unified Diff: extensions/renderer/resources/extension_custom_bindings.js

Issue 2105033003: tabId support to chrome.extensions.getViews() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor followup to patch 5 Created 4 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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/resources/extension_custom_bindings.js
diff --git a/extensions/renderer/resources/extension_custom_bindings.js b/extensions/renderer/resources/extension_custom_bindings.js
index 68450d56b3afbbf6fe39b44c9898274060e0be8b..a7a59772a2494f9a5dba456773f7eb0c1ae870f5 100644
--- a/extensions/renderer/resources/extension_custom_bindings.js
+++ b/extensions/renderer/resources/extension_custom_bindings.js
@@ -22,6 +22,7 @@ var manifestVersion = requireNative('process').GetManifestVersion();
// chrome.windows API won't exist unless this extension has permission for it;
// which may not be the case.
var WINDOW_ID_NONE = -1;
+var TAB_ID_NONE = -1;
binding.registerCustomHook(function(bindingsAPI, extensionId) {
var extension = bindingsAPI.compiledApi;
@@ -35,6 +36,7 @@ binding.registerCustomHook(function(bindingsAPI, extensionId) {
apiFunctions.setHandleRequest('getViews', function(properties) {
var windowId = WINDOW_ID_NONE;
+ var tabId = TAB_ID_NONE;
var type = 'ALL';
if (properties) {
if (properties.type != null) {
@@ -43,18 +45,21 @@ binding.registerCustomHook(function(bindingsAPI, extensionId) {
if (properties.windowId != null) {
windowId = properties.windowId;
}
+ if (properties.tabId != null) {
+ tabId = properties.tabId;
+ }
}
- return GetExtensionViews(windowId, type);
+ return GetExtensionViews(windowId, tabId, type);
});
apiFunctions.setHandleRequest('getBackgroundPage', function() {
- return GetExtensionViews(-1, 'BACKGROUND')[0] || null;
+ return GetExtensionViews(-1, -1, 'BACKGROUND')[0] || null;
});
apiFunctions.setHandleRequest('getExtensionTabs', function(windowId) {
if (windowId == null)
windowId = WINDOW_ID_NONE;
- return GetExtensionViews(windowId, 'TAB');
+ return GetExtensionViews(windowId, -1, 'TAB');
});
apiFunctions.setHandleRequest('getURL', function(path) {
« no previous file with comments | « extensions/renderer/resources/app_window_custom_bindings.js ('k') | extensions/renderer/resources/runtime_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698