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

Unified Diff: chrome/renderer/resources/extensions/utils.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/utils.js
diff --git a/chrome/renderer/resources/extensions/utils.js b/chrome/renderer/resources/extensions/utils.js
index 47d827745128bb7e40b2af5baa633957ee25dc21..448b5167412e34bf6139dafbd94fbd3b7bb90071 100644
--- a/chrome/renderer/resources/extensions/utils.js
+++ b/chrome/renderer/resources/extensions/utils.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+var chrome = requireNative('chrome').GetChrome();
+
function forEach(dict, f) {
for (key in dict) {
if (dict.hasOwnProperty(key))
@@ -25,5 +27,12 @@ function lookup(array_of_dictionaries, field, value) {
}
}
+function loadRefDependency(ref) {
+ // TODO(cduvall): Handle refs in current namespace.
+ var parts = ref.split(".");
+ return chrome[parts.slice(0, parts.length - 1).join(".")];
+}
+
exports.forEach = forEach;
+exports.loadRefDependency = loadRefDependency;
exports.lookup = lookup;

Powered by Google App Engine
This is Rietveld 408576698