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

Side by Side Diff: chrome/browser/resources/uber/uber_utils.js

Issue 501153005: uber: compile fixes + .gyp file to build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview A collection of utility methods for UberPage and its contained 6 * @fileoverview A collection of utility methods for UberPage and its contained
7 * pages. 7 * pages.
8 */ 8 */
9 9
10 cr.define('uber', function() { 10 cr.define('uber', function() {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 * @return {boolean} Whether this frame has a parent. 107 * @return {boolean} Whether this frame has a parent.
108 */ 108 */
109 function hasParent() { 109 function hasParent() {
110 return window != window.parent; 110 return window != window.parent;
111 } 111 }
112 112
113 /** 113 /**
114 * Invokes a method on the parent window (UberPage). This is a convenience 114 * Invokes a method on the parent window (UberPage). This is a convenience
115 * method for API calls into the uber page. 115 * method for API calls into the uber page.
116 * @param {string} method The name of the method to invoke. 116 * @param {string} method The name of the method to invoke.
117 * @param {(Object|number)=} opt_params Optional property bag of parameters 117 * @param {?=} opt_params Optional property bag of parameters
118 * to pass to the invoked method. 118 * to pass to the invoked method.
119 * @private 119 * @private
120 */ 120 */
121 function invokeMethodOnParent(method, opt_params) { 121 function invokeMethodOnParent(method, opt_params) {
122 if (!hasParent()) 122 if (!hasParent())
123 return; 123 return;
124 124
125 invokeMethodOnWindow(window.parent, method, opt_params, 'chrome://chrome'); 125 invokeMethodOnWindow(window.parent, method, opt_params, 'chrome://chrome');
126 } 126 }
127 127
128 /** 128 /**
129 * Invokes a method on the target window. 129 * Invokes a method on the target window.
130 * @param {string} method The name of the method to invoke. 130 * @param {string} method The name of the method to invoke.
131 * @param {(Object|number)=} opt_params Optional property bag of parameters 131 * @param {?=} opt_params Optional property bag of
132 * to pass to the invoked method. 132 * parameters to pass to the invoked method.
133 * @param {string=} opt_url The origin of the target window. 133 * @param {string=} opt_url The origin of the target window.
134 * @private 134 * @private
135 */ 135 */
136 function invokeMethodOnWindow(targetWindow, method, opt_params, opt_url) { 136 function invokeMethodOnWindow(targetWindow, method, opt_params, opt_url) {
137 var data = {method: method, params: opt_params}; 137 var data = {method: method, params: opt_params};
138 targetWindow.postMessage(data, opt_url ? opt_url : '*'); 138 targetWindow.postMessage(data, opt_url ? opt_url : '*');
139 } 139 }
140 140
141 /** 141 /**
142 * Updates the page's history state. If the page is embedded in a child, 142 * Updates the page's history state. If the page is embedded in a child,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 return { 198 return {
199 invokeMethodOnParent: invokeMethodOnParent, 199 invokeMethodOnParent: invokeMethodOnParent,
200 invokeMethodOnWindow: invokeMethodOnWindow, 200 invokeMethodOnWindow: invokeMethodOnWindow,
201 onContentFrameLoaded: onContentFrameLoaded, 201 onContentFrameLoaded: onContentFrameLoaded,
202 pushState: pushState, 202 pushState: pushState,
203 replaceState: replaceState, 203 replaceState: replaceState,
204 setTitle: setTitle, 204 setTitle: setTitle,
205 }; 205 };
206 }); 206 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/uber/uber.js ('k') | third_party/closure_compiler/compiled_resources.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698