From ef88b05837e968daf0389fce203c81dba16c17ed Mon Sep 17 00:00:00 2001 From: "mikhail.pozdnyakov" Date: Fri, 26 Feb 2016 02:48:10 -0800 Subject: [chrome.displaySource] further implementation of call completion callbacks The API implementation determines when and with which arguments the 'startSession'/'terminateSession' completion callbacks are invoked. The 'exceeded_session_limit_error' session error type is eliminated and substituted with 'startSession' completion callback call (which is more natural since this problem is detected before a new session is started). JS bindings code is simplified. BUG=242107 Review URL: https://codereview.chromium.org/1730583002 Cr-Commit-Position: refs/heads/master@{#377864} --- extensions/renderer/resources/display_source_custom_bindings.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'extensions/renderer/resources') diff --git a/extensions/renderer/resources/display_source_custom_bindings.js b/extensions/renderer/resources/display_source_custom_bindings.js index a1345ff..38d7e3c 100644 --- a/extensions/renderer/resources/display_source_custom_bindings.js +++ b/extensions/renderer/resources/display_source_custom_bindings.js @@ -18,7 +18,7 @@ function callbackWrapper(callback, method, message) { try { if (message !== null) - lastError.set('displaySource.startSession', message, null, chrome); + lastError.set(method, message, null, chrome); callback(); } finally { lastError.clear(chrome); @@ -40,7 +40,7 @@ binding.registerCustomHook(function(bindingsAPI, extensionId) { apiFunctions.setHandleRequest( 'startSession', function(sessionInfo, callback) { try { - var callId = natives.StartSession(sessionInfo, callbackWrapper); + var callId = natives.StartSession(sessionInfo); callbacksInfo[callId] = { callback: callback, method: 'displaySource.startSession' @@ -52,7 +52,7 @@ binding.registerCustomHook(function(bindingsAPI, extensionId) { apiFunctions.setHandleRequest( 'terminateSession', function(sink_id, callback) { try { - var callId = natives.TerminateSession(sink_id, callbackWrapper); + var callId = natives.TerminateSession(sink_id); callbacksInfo[callId] = { callback: callback, method: 'displaySource.terminateSession' -- cgit v1.1