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

Side by Side Diff: ios/web/web_state/js/resources/navigation.js

Issue 2810263002: Deprecate __gCrWeb['sendFaviconsToHost'] by inlining it. (Closed)
Patch Set: add missing goog.require Created 3 years, 8 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
« no previous file with comments | « ios/web/web_state/js/resources/core.js ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 Navigation related APIs. 6 * @fileoverview Navigation related APIs.
7 */ 7 */
8 8
9 goog.provide('__crWeb.navigation'); 9 goog.provide('__crWeb.navigation');
10 10
11 goog.require('__crWeb.common');
11 goog.require('__crWeb.message'); 12 goog.require('__crWeb.message');
12 13
13 /** Beginning of anonymouse object */ 14 /** Beginning of anonymouse object */
14 (function() { 15 (function() {
15 16
16 /** 17 /**
17 * A popstate event needs to be fired anytime the active history entry 18 * A popstate event needs to be fired anytime the active history entry
18 * changes without an associated document change. Either via back, forward, go 19 * changes without an associated document change. Either via back, forward, go
19 * navigation or by loading the URL, clicking on a link, etc. 20 * navigation or by loading the URL, clicking on a link, etc.
20 */ 21 */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 * @private 60 * @private
60 */ 61 */
61 var originalWindowHistoryPushState = window.history.pushState; 62 var originalWindowHistoryPushState = window.history.pushState;
62 var originalWindowHistoryReplaceState = window.history.replaceState; 63 var originalWindowHistoryReplaceState = window.history.replaceState;
63 64
64 __gCrWeb['replaceWebViewURL'] = function(url, stateObject) { 65 __gCrWeb['replaceWebViewURL'] = function(url, stateObject) {
65 originalWindowHistoryReplaceState.call(history, stateObject, '', url); 66 originalWindowHistoryReplaceState.call(history, stateObject, '', url);
66 }; 67 };
67 68
68 /** 69 /**
70 * Handles document load completion tasks. Invoked from
71 * [WKNavigationDelegate webView:didFinishNavigation:], when document load is
72 * complete.
73 */
74 __gCrWeb.didFinishNavigation = function() {
Eugene But (OOO till 7-30) 2017/04/12 21:33:08 Do you want to move this to legacy.js instead?
75 // Send the favicons to the browser.
76 __gCrWeb.message.invokeOnHost({'command': 'document.favicons',
77 'favicons': __gCrWeb.common.getFavicons()});
78
79 // Add placeholders for plugin content.
80 if (__gCrWeb.common.updatePluginPlaceholders())
81 __gCrWeb.message.invokeOnHost({'command': 'addPluginPlaceholders'});
82 }
83
84 /**
69 * Intercept window.history methods to call back/forward natively. 85 * Intercept window.history methods to call back/forward natively.
70 */ 86 */
71 window.history.back = function() { 87 window.history.back = function() {
72 __gCrWeb.message.invokeOnHost({'command': 'window.history.back'}); 88 __gCrWeb.message.invokeOnHost({'command': 'window.history.back'});
73 }; 89 };
74 90
75 window.history.forward = function() { 91 window.history.forward = function() {
76 __gCrWeb.message.invokeOnHost({'command': 'window.history.forward'}); 92 __gCrWeb.message.invokeOnHost({'command': 'window.history.forward'});
77 }; 93 };
78 94
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 originalWindowHistoryReplaceState.call(history, stateObject, 126 originalWindowHistoryReplaceState.call(history, stateObject,
111 pageTitle, pageUrl); 127 pageTitle, pageUrl);
112 __gCrWeb.message.invokeOnHost( 128 __gCrWeb.message.invokeOnHost(
113 {'command': 'window.history.didReplaceState', 129 {'command': 'window.history.didReplaceState',
114 'stateObject': serializedState, 130 'stateObject': serializedState,
115 'baseUrl': document.baseURI, 131 'baseUrl': document.baseURI,
116 'pageUrl': pageUrl.toString()}); 132 'pageUrl': pageUrl.toString()});
117 }; 133 };
118 134
119 window.addEventListener('hashchange', function(evt) { 135 window.addEventListener('hashchange', function(evt) {
136 // Because hash changes don't trigger __gCrWeb.didFinishNavigation, so fetch
137 // favicons for the new page manually.
138 __gCrWeb.message.invokeOnHost({'command': 'document.favicons',
139 'favicons': __gCrWeb.common.getFavicons()});
140
120 __gCrWeb.message.invokeOnHost({'command': 'window.hashchange'}); 141 __gCrWeb.message.invokeOnHost({'command': 'window.hashchange'});
121 }); 142 });
122 143
123 /** Flush the message queue. */ 144 /** Flush the message queue. */
124 if (__gCrWeb.message) { 145 if (__gCrWeb.message) {
125 __gCrWeb.message.invokeQueues(); 146 __gCrWeb.message.invokeQueues();
126 } 147 }
127 148
128 }()); // End of anonymouse object 149 }()); // End of anonymouse object
OLDNEW
« no previous file with comments | « ios/web/web_state/js/resources/core.js ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698