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

Unified Diff: chrome/renderer/resources/extensions/app_custom_bindings.js

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android compilation Created 7 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 side-by-side diff with in-line comments
Download patch
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;
+}
« no previous file with comments | « chrome/renderer/resources/extensions/apitest.js ('k') | chrome/renderer/resources/extensions/app_runtime_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698