OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 function handleMouseDownInFrame(e) { | 60 function handleMouseDownInFrame(e) { |
61 if (!e.isSynthetic && !document.hasFocus()) | 61 if (!e.isSynthetic && !document.hasFocus()) |
62 window.focus(); | 62 window.focus(); |
63 } | 63 } |
64 | 64 |
65 /** | 65 /** |
66 * Handles 'message' events on window. | 66 * Handles 'message' events on window. |
67 * @param {Event} e The message event. | 67 * @param {Event} e The message event. |
68 */ | 68 */ |
69 function handleWindowMessage(e) { | 69 function handleWindowMessage(e) { |
70 e = /** @type {!MessageEvent.<!{method: string, params: *}>} */(e); | 70 e = /** @type {!MessageEvent<!{method: string, params: *}>} */(e); |
71 if (e.data.method === 'frameSelected') { | 71 if (e.data.method === 'frameSelected') { |
72 handleFrameSelected(); | 72 handleFrameSelected(); |
73 } else if (e.data.method === 'mouseWheel') { | 73 } else if (e.data.method === 'mouseWheel') { |
74 handleMouseWheel( | 74 handleMouseWheel( |
75 /** @type {{deltaX: number, deltaY: number}} */(e.data.params)); | 75 /** @type {{deltaX: number, deltaY: number}} */(e.data.params)); |
76 } else if (e.data.method === 'mouseDown') { | 76 } else if (e.data.method === 'mouseDown') { |
77 handleMouseDown(); | 77 handleMouseDown(); |
78 } else if (e.data.method === 'popState') { | 78 } else if (e.data.method === 'popState') { |
79 handlePopState(e.data.params.state, e.data.params.path); | 79 handlePopState(e.data.params.state, e.data.params.path); |
80 } | 80 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 return { | 218 return { |
219 invokeMethodOnParent: invokeMethodOnParent, | 219 invokeMethodOnParent: invokeMethodOnParent, |
220 invokeMethodOnWindow: invokeMethodOnWindow, | 220 invokeMethodOnWindow: invokeMethodOnWindow, |
221 onContentFrameLoaded: onContentFrameLoaded, | 221 onContentFrameLoaded: onContentFrameLoaded, |
222 pushState: pushState, | 222 pushState: pushState, |
223 replaceState: replaceState, | 223 replaceState: replaceState, |
224 setTitle: setTitle, | 224 setTitle: setTitle, |
225 }; | 225 }; |
226 }); | 226 }); |
OLD | NEW |