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

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

Issue 988963003: Add Application.Delegate.stop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 /** 144 /**
145 * @param {function(*=):void} resolve 145 * @param {function(*=):void} resolve
146 * @param {function(*=):void} reject 146 * @param {function(*=):void} reject
147 */ 147 */
148 return new Promise(function(resolve, reject) { 148 return new Promise(function(resolve, reject) {
149 var appWindow = chrome.app.window.get(id); 149 var appWindow = chrome.app.window.get(id);
150 if (!appWindow) { 150 if (!appWindow) {
151 return Promise.reject(new Error(chrome.runtime.lastError.message)); 151 return Promise.reject(new Error(chrome.runtime.lastError.message));
152 } 152 }
153 appWindow.onClosed.addListener(resolve); 153 appWindow.onClosed.addListener(resolve);
154 appWindow.close(); 154 appWindow.close();
Jamie 2015/03/07 02:12:54 @kelvinp: I feel that this should just call applic
kelvinp 2015/03/09 17:48:49 This class is currently run at the background page
155 }); 155 });
156 }; 156 };
157 157
158 /** 158 /**
159 * @return {number} the next available window id. 159 * @return {number} the next available window id.
160 */ 160 */
161 function getNextWindowId() { 161 function getNextWindowId() {
162 var appWindows = chrome.app.window.getAll(); 162 var appWindows = chrome.app.window.getAll();
163 var lastId = /** @type(number) */ (0); 163 var lastId = /** @type(number) */ (0);
164 appWindows.forEach(function(appWindow) { 164 appWindows.forEach(function(appWindow) {
165 base.debug.assert(Number.isInteger(appWindow.id), 165 base.debug.assert(Number.isInteger(appWindow.id),
166 "Window Id should be an integer"); 166 "Window Id should be an integer");
167 var id = parseInt(appWindow.id, 10); 167 var id = parseInt(appWindow.id, 10);
168 if (lastId <= id) { 168 if (lastId <= id) {
169 lastId = id; 169 lastId = id;
170 } 170 }
171 }); 171 });
172 return ++lastId; 172 return ++lastId;
173 } 173 }
174 174
175 })(); 175 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698