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

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: comments/TODOs Created 7 years, 11 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..8e805dba8b20b25481b78f9ac4ff649430693989 100644
--- a/chrome/renderer/resources/extensions/app_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/app_custom_bindings.js
@@ -5,6 +5,8 @@
// Custom bindings for the app API.
var appNatives = requireNative('app');
+var DCHECK = requireNative('logging').DCHECK;
+var chrome = requireNative('chrome').GetChrome();
// This becomes chrome.app
var app = {
@@ -23,6 +25,20 @@ var app = {
// documentation.
app.__defineGetter__('isInstalled', appNatives.GetIsInstalled);
+// Define getters for app sub-APIs like app.runtime.
+// TODO(cduvall): Take this out once object chain works.
+app.__defineGetter__('runtime', function() {
+ return chrome['app.runtime'];
+});
+
+app.__defineGetter__('window', function() {
+ return chrome['app.window'];
+});
+
+app.__defineGetter__('currentWindowInternal', function() {
+ return chrome['app.currentWindowInternal'];
+});
+
// Called by app_bindings.cc.
// This becomes chromeHidden.app
var chromeHiddenApp = {

Powered by Google App Engine
This is Rietveld 408576698