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

Side by Side Diff: remoting/webapp/crd/js/app_launcher.js

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused types Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * AppLauncher is an interface that allows the client code to launch and close 7 * AppLauncher is an interface that allows the client code to launch and close
8 * the app without knowing the implementation difference between a v1 app and 8 * the app without knowing the implementation difference between a v1 app and
9 * a v2 app. 9 * a v2 app.
10 * 10 *
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 /** 71 /**
72 * @param {function(*=):void} resolve 72 * @param {function(*=):void} resolve
73 * @param {function(*=):void} reject 73 * @param {function(*=):void} reject
74 */ 74 */
75 return new Promise(function(resolve, reject) { 75 return new Promise(function(resolve, reject) {
76 /** @param {chrome.Tab} tab The retrieved tab. */ 76 /** @param {chrome.Tab} tab The retrieved tab. */
77 chrome.tabs.get(id, function(tab) { 77 chrome.tabs.get(id, function(tab) {
78 if (!tab) { 78 if (!tab) {
79 reject(new Error(chrome.runtime.lastError.message)); 79 reject(new Error(chrome.runtime.lastError.message));
80 } else { 80 } else {
81 chrome.tabs.remove(tab.id, resolve); 81 chrome.tabs.remove(tab.id, /** @type {function(*=):void} */ (resolve));
82 } 82 }
83 }); 83 });
84 }); 84 });
85 }; 85 };
86 86
87 87
88 /** 88 /**
89 * @constructor 89 * @constructor
90 * @implements {remoting.AppLauncher} 90 * @implements {remoting.AppLauncher}
91 */ 91 */
(...skipping 12 matching lines...) Expand all
104 * @param {function(*=):void} resolve 104 * @param {function(*=):void} resolve
105 * @param {function(*=):void} reject 105 * @param {function(*=):void} reject
106 */ 106 */
107 return new Promise(function(resolve, reject) { 107 return new Promise(function(resolve, reject) {
108 chrome.app.window.create(url, { 108 chrome.app.window.create(url, {
109 'width': 800, 109 'width': 800,
110 'height': 600, 110 'height': 600,
111 'frame': 'none', 111 'frame': 'none',
112 'id': String(remoting.V2AppLauncher.nextWindowId_++) 112 'id': String(remoting.V2AppLauncher.nextWindowId_++)
113 }, 113 },
114 /** @param {AppWindow} appWindow */ 114 /** @param {AppWindow=} appWindow */
115 function(appWindow) { 115 function(appWindow) {
116 if (!appWindow) { 116 if (!appWindow) {
117 reject(new Error(chrome.runtime.lastError.message)); 117 reject(new Error(chrome.runtime.lastError.message));
118 } else { 118 } else {
119 resolve(appWindow.id); 119 resolve(appWindow.id);
120 } 120 }
121 }); 121 });
122 }); 122 });
123 }; 123 };
124 124
125 remoting.V2AppLauncher.prototype.close = function(id) { 125 remoting.V2AppLauncher.prototype.close = function(id) {
126 var appWindow = chrome.app.window.get(id); 126 var appWindow = chrome.app.window.get(id);
127 if (!appWindow) { 127 if (!appWindow) {
128 return Promise.reject(new Error(chrome.runtime.lastError.message)); 128 return Promise.reject(new Error(chrome.runtime.lastError.message));
129 } 129 }
130 appWindow.close(); 130 appWindow.close();
131 return Promise.resolve(); 131 return Promise.resolve();
132 }; 132 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698