Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Custom binding for the Display Source API. | |
| 6 | |
| 7 var binding = require('binding').Binding.create('displaySource'); | |
| 8 var chrome = requireNative('chrome').GetChrome(); | |
| 9 var lastError = require('lastError'); | |
| 10 var natives = requireNative('display_source'); | |
| 11 | |
| 12 binding.registerCustomHook(function(bindingsAPI, extensionId) { | |
| 13 var apiFunctions = bindingsAPI.apiFunctions; | |
| 14 apiFunctions.setHandleRequest('startSession', | |
| 15 function(sessionInfo, callback) { | |
| 16 try { | |
| 17 natives.StartSession(sessionInfo); | |
| 18 } catch (e) { | |
| 19 lastError.set('displaySource.startSession', e.message, null, chrome); | |
|
asargent_no_longer_on_chrome
2015/12/07 21:47:49
Looks like you're missing a matching call to lastE
Mikhail
2015/12/08 07:44:44
Done.
| |
| 20 } finally { | |
| 21 if (callback !== undefined) | |
| 22 callback(); | |
| 23 } | |
| 24 }); | |
| 25 apiFunctions.setHandleRequest('terminateSession', | |
| 26 function(sink_id, callback) { | |
| 27 try { | |
| 28 natives.TerminateSession(sink_id); | |
| 29 } catch (e) { | |
| 30 lastError.set( | |
|
asargent_no_longer_on_chrome
2015/12/07 21:47:49
same thing here
Mikhail
2015/12/08 07:44:44
Done.
| |
| 31 'displaySource.terminateSession', e.message, null, chrome); | |
| 32 } finally { | |
| 33 if (callback !== undefined) | |
| 34 callback(); | |
| 35 } | |
| 36 }); | |
| 37 }); | |
| 38 | |
| 39 exports.$set('binding', binding.generate()); | |
| OLD | NEW |