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

Unified Diff: chrome/browser/resources/hangouts_services/thunk.js

Issue 35873003: Bundle Hangouts Services extension with Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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: chrome/browser/resources/hangouts_services/thunk.js
diff --git a/chrome/browser/resources/hangouts_services/thunk.js b/chrome/browser/resources/hangouts_services/thunk.js
new file mode 100644
index 0000000000000000000000000000000000000000..429a213b1300124618e879aeb01e0b6329f5b60f
--- /dev/null
+++ b/chrome/browser/resources/hangouts_services/thunk.js
@@ -0,0 +1,65 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+chrome.runtime.onMessageExternal.addListener(
+ function(message, sender, sendResponse) {
+ function doSendResponse(value, error) {
+ var errorMessage = error || chrome.extension.lastError;
+ sendResponse({'value': value, 'error': errorMessage});
+ }
+ try {
+ var method = message['method'];
+ var origin = message['origin'];
+ if (method == 'chooseDesktopMedia') {
arv (Not doing code reviews) 2013/10/23 16:32:27 This would have been cleaner as a switch (yes you
vrk (LEFT CHROMIUM) 2013/10/23 19:10:02 Thanks, will do in a follow-up CL.
+ chrome.desktopCapture.chooseDesktopMedia(
+ ['screen', 'window'], sender.tab, doSendResponse);
+ return true;
+ } else if (method == 'cpu.getInfo') {
+ chrome.system.cpu.getInfo(doSendResponse);
+ return true;
+ } else if (method == 'logging.setMetadata') {
+ var metaData = message['metaData'];
+ chrome.webrtcLoggingPrivate.setMetaData(
+ sender.tab.id, origin, metaData, doSendResponse);
+ return true;
+ } else if (method == 'logging.start') {
+ chrome.webrtcLoggingPrivate.start(sender.tab.id, origin, doSendResponse);
+ return true;
+ } else if (method == 'logging.uploadOnRenderClose') {
+ chrome.webrtcLoggingPrivate.setUploadOnRenderClose(
+ sender.tab.id, origin, true);
+ doSendResponse();
+ return false;
+ } else if (method == 'logging.stop') {
+ chrome.webrtcLoggingPrivate.stop(sender.tab.id, origin, doSendResponse);
+ return true;
+ } else if (method == 'logging.upload') {
+ chrome.webrtcLoggingPrivate.upload(sender.tab.id, origin, doSendResponse);
+ return true;
+ } else if (method == 'logging.discard') {
+ chrome.webrtcLoggingPrivate.discard(
+ sender.tab.id, origin, doSendResponse);
+ return true;
+ } else if (method == 'getSinks') {
+ chrome.webrtcAudioPrivate.getSinks(doSendResponse);
+ return true;
+ } else if (method == 'getActiveSink') {
+ chrome.webrtcAudioPrivate.getActiveSink(sender.tab.id, doSendResponse);
+ return true;
+ } else if (method == 'setActiveSink') {
+ var sinkId = message['sinkId'];
+ chrome.webrtcAudioPrivate.setActiveSink(
+ sender.tab.id, sinkId, doSendResponse);
+ return true;
+ } else if (method == 'getAssociatedSink') {
+ var sourceId = message['sourceId'];
+ chrome.webrtcAudioPrivate.getAssociatedSink(
+ origin, sourceId, doSendResponse);
+ return true;
+ }
+ throw new Error('Unknown method: ' + method);
+ } catch (e) {
+ doSendResponse(null, e.name + ': ' + e.message);
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698