Chromium Code Reviews| Index: chrome/renderer/resources/extensions/app_custom_bindings.js |
| diff --git a/chrome/renderer/resources/extensions/app_custom_bindings.js b/chrome/renderer/resources/extensions/app_custom_bindings.js |
| index 1a8bbcc7d6dab3ecaf05cee5574a61aed13e9ca4..db7ed09324194f1d31a3128872176b46113a7e04 100644 |
| --- a/chrome/renderer/resources/extensions/app_custom_bindings.js |
| +++ b/chrome/renderer/resources/extensions/app_custom_bindings.js |
| @@ -2,9 +2,12 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -// Custom bindings for the app API. |
| +// Custom binding for the app API. |
| var appNatives = requireNative('app'); |
| +var chrome = requireNative('chrome').GetChrome(); |
| +var GetAvailability = requireNative('v8_context').GetAvailability; |
| +var logging = requireNative('logging'); |
| // This becomes chrome.app |
| var app = { |
| @@ -23,7 +26,7 @@ var app = { |
| // documentation. |
| app.__defineGetter__('isInstalled', appNatives.GetIsInstalled); |
| -// Called by app_bindings.cc. |
| +// Called by app_binding.cc. |
| // This becomes chromeHidden.app |
| var chromeHiddenApp = { |
| onGetAppNotifyChannelResponse: function(channelId, error, callbackId) { |
| @@ -43,7 +46,7 @@ var chromeHiddenApp = { |
| // appNotification stuff. |
| // |
| -// TODO(kalman): move this stuff to its own custom bindings. |
| +// TODO(kalman): move this stuff to its own custom binding. |
| // It will be bit tricky since I'll need to look into why there are |
| // permissions defined for app notifications, yet this always sets it up? |
| var callbacks = {}; |
| @@ -67,8 +70,13 @@ app.installState = function getInstallState(callback) { |
| appNatives.GetInstallState(callbackId); |
| }; |
| -// These must match the names in InstallAppBindings() in |
| +// These must match the names in InstallAppbinding() in |
| // chrome/renderer/extensions/dispatcher.cc. |
| -exports.chromeApp = app; |
| -exports.chromeAppNotifications = appNotifications; |
| -exports.chromeHiddenApp = chromeHiddenApp; |
| +var availability = GetAvailability('app'); |
| +if (availability.is_available) { |
| + exports.chromeApp = app; |
| + exports.chromeAppNotifications = appNotifications; |
| + exports.chromeHiddenApp = chromeHiddenApp; |
| +} else { |
| + logging.Error('chrome.app is not available: ' + availability.message); |
|
not at google - send to devlin
2013/02/15 22:26:17
Unfortunately we can't do this, it ends up showing
cduvall
2013/02/19 23:58:49
Done.
|
| +} |