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

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: 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/utils.js
diff --git a/chrome/renderer/resources/extensions/utils.js b/chrome/renderer/resources/extensions/utils.js
index beb9a515f3fb73ad89c0a281766655cc36bf00d1..ed35e15f9fcf11e06d2a2a5792ff35c4a580d03a 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 (var key in dict) {
if (dict.hasOwnProperty(key))
@@ -25,5 +27,16 @@ function lookup(array_of_dictionaries, field, value) {
}
}
+// Specify |currentApi| if this should return an API for $refs in the current
+// namespace.
+function loadRefDependency(ref, currentApi) {
+ var parts = ref.split(".");
+ if (parts.length > 1)
+ return chrome[parts.slice(0, parts.length - 1).join(".")];
+ else
+ return currentApi;
+}
+
exports.forEach = forEach;
+exports.loadRefDependency = loadRefDependency;
exports.lookup = lookup;

Powered by Google App Engine
This is Rietveld 408576698