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

Unified Diff: chrome/browser/resources/uber/uber_utils.js

Issue 9265020: [uber] make the navigation controls an iframe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: opt = Created 8 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
« no previous file with comments | « chrome/browser/resources/uber/uber_frame.js ('k') | chrome/browser/ui/webui/chrome_web_ui_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/uber/uber_utils.js
diff --git a/chrome/browser/resources/uber/uber_utils.js b/chrome/browser/resources/uber/uber_utils.js
index 49d4b54fe9439dd45aa039cb034c72c8938ca977..a537454bc0f81d3641530cf27b9ce3f3c9e6dcc0 100644
--- a/chrome/browser/resources/uber/uber_utils.js
+++ b/chrome/browser/resources/uber/uber_utils.js
@@ -12,19 +12,32 @@ cr.define('uber', function() {
* Invokes a method on the parent window (UberPage). This is a convenience
* method for API calls into the uber page.
* @param {String} method The name of the method to invoke.
- * @param {Object} params Optional property bag of parameters to pass to the
- * invoked method.
+ * @param {Object=} opt_params Optional property bag of parameters to pass to
+ * the invoked method.
* @private
*/
- function invokeMethodOnParent(method, params) {
- if (!window.parent)
+ function invokeMethodOnParent(method, opt_params) {
+ if (window.location == window.parent.location)
return;
- var data = {method: method, params: params};
- window.parent.postMessage(data, 'chrome://chrome');
- };
+ invokeMethodOnWindow(window.parent, method, opt_params, 'chrome://chrome');
+ }
- return {
- invokeMethodOnParent: invokeMethodOnParent
+ /**
+ * Invokes a method on the target window.
+ * @param {String} method The name of the method to invoke.
+ * @param {Object=} opt_params Optional property bag of parameters to pass to
+ * the invoked method.
+ * @param {String=} opt_url The origin of the target window.
+ * @private
+ */
+ function invokeMethodOnWindow(targetWindow, method, opt_params, opt_url) {
+ var data = {method: method, params: opt_params};
+ targetWindow.postMessage(data, opt_url ? opt_url : '*');
}
+
+ return {
+ invokeMethodOnParent: invokeMethodOnParent,
+ invokeMethodOnWindow: invokeMethodOnWindow,
+ };
});
« no previous file with comments | « chrome/browser/resources/uber/uber_frame.js ('k') | chrome/browser/ui/webui/chrome_web_ui_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698