OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Custom binding for the app API. | 5 // Custom binding for the app API. |
6 | 6 |
7 var GetAvailability = requireNative('v8_context').GetAvailability; | 7 var GetAvailability = requireNative('v8_context').GetAvailability; |
8 if (!GetAvailability('app').is_available) { | 8 if (!GetAvailability('app').is_available) { |
9 exports.chromeApp = {}; | 9 exports.binding = {}; |
10 exports.onInstallStateResponse = function(){}; | 10 exports.onInstallStateResponse = function(){}; |
11 return; | 11 return; |
12 } | 12 } |
13 | 13 |
14 var appNatives = requireNative('app'); | 14 var appNatives = requireNative('app'); |
15 var process = requireNative('process'); | 15 var process = requireNative('process'); |
16 var extensionId = process.GetExtensionId(); | 16 var extensionId = process.GetExtensionId(); |
17 var logActivity = requireNative('activityLogger'); | 17 var logActivity = requireNative('activityLogger'); |
18 | 18 |
19 function wrapForLogging(fun) { | 19 function wrapForLogging(fun) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 app.installState = function getInstallState(callback) { | 66 app.installState = function getInstallState(callback) { |
67 var callbackId = nextCallbackId++; | 67 var callbackId = nextCallbackId++; |
68 callbacks[callbackId] = callback; | 68 callbacks[callbackId] = callback; |
69 appNatives.GetInstallState(callbackId); | 69 appNatives.GetInstallState(callbackId); |
70 }; | 70 }; |
71 if (extensionId) | 71 if (extensionId) |
72 app.installState = wrapForLogging(app.installState); | 72 app.installState = wrapForLogging(app.installState); |
73 | 73 |
74 exports.binding = app; | 74 exports.binding = app; |
75 exports.onInstallStateResponse = onInstallStateResponse; | 75 exports.onInstallStateResponse = onInstallStateResponse; |
OLD | NEW |