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..0b9dd89b41df7b8d0edb9b402419f2e58c5140cf 100644 |
--- a/chrome/renderer/resources/extensions/app_custom_bindings.js |
+++ b/chrome/renderer/resources/extensions/app_custom_bindings.js |
@@ -2,9 +2,11 @@ |
// 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; |
// This becomes chrome.app |
var app = { |
@@ -43,7 +45,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 +69,11 @@ 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; |
+} |