OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 * Checks for an extension error that occurred during the asynchronous call. | 6 * Checks for an extension error that occurred during the asynchronous call. |
7 * If an error occurs, will invoke the error callback and throw an exception. | 7 * If an error occurs, will invoke the error callback and throw an exception. |
8 * | 8 * |
9 * @param {function(!Error)} errCallback The callback to invoke for error | 9 * @param {function(!Error)} errCallback The callback to invoke for error |
10 * reporting. | 10 * reporting. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 */ | 64 */ |
65 function updateWindow(updateInfo, callback, errCallback) { | 65 function updateWindow(updateInfo, callback, errCallback) { |
66 chrome.windows.getCurrent({}, function(window) { | 66 chrome.windows.getCurrent({}, function(window) { |
67 checkForExtensionError(errCallback); | 67 checkForExtensionError(errCallback); |
68 chrome.windows.update(window.id, updateInfo, function(window) { | 68 chrome.windows.update(window.id, updateInfo, function(window) { |
69 checkForExtensionError(errCallback); | 69 checkForExtensionError(errCallback); |
70 callback(); | 70 callback(); |
71 }); | 71 }); |
72 }); | 72 }); |
73 } | 73 } |
| 74 |
| 75 /** |
| 76 * Launches an app with the specified id. |
| 77 * |
| 78 * @param {string} id The ID of the app to launch. |
| 79 * @param {function()} callback Invoked when the launch event is complete. |
| 80 * @param {function(!Error)} errCallback The callback to invoke for error |
| 81 * reporting. |
| 82 */ |
| 83 function launchApp(id, callback, errCallback) { |
| 84 chrome.management.launchApp(id, function() { |
| 85 checkForExtensionError(errCallback); |
| 86 callback(); |
| 87 }); |
| 88 } |
OLD | NEW |