| Index: ios/web/web_state/js/resources/core_dynamic_wk.js
|
| diff --git a/ios/web/web_state/js/resources/core_dynamic_wk.js b/ios/web/web_state/js/resources/core_dynamic_wk.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dd91478774521590971eedeffb0eff541bd5cc23
|
| --- /dev/null
|
| +++ b/ios/web/web_state/js/resources/core_dynamic_wk.js
|
| @@ -0,0 +1,59 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Scripts that are conceptually part of core.js, but have WKWebView-specific
|
| +// details/behaviors.
|
| +
|
| +goog.provide('__crweb.core_dynamic_wk');
|
| +
|
| +/**
|
| + * Namespace for this module.
|
| + */
|
| +__gCrWeb.core_dynamic = {};
|
| +
|
| +/* Beginning of anonymous object. */
|
| +new function() {
|
| + /**
|
| + * Adds WKWebView specific event listeners.
|
| + */
|
| + __gCrWeb.core_dynamic.addEventListeners = function() {
|
| + // So far there are no WKWebView specific event listeners.
|
| + };
|
| +
|
| + /**
|
| + * Applies WKWebView specific document-level overrides. Script injection for
|
| + * WKWebView always happens after the document is presented; therefore, there
|
| + * is no need to provide for invoking documentInject at a later time.
|
| + */
|
| + __gCrWeb.core_dynamic.documentInject = function() {
|
| + // Flush the message queue.
|
| + if (__gCrWeb.message) {
|
| + __gCrWeb.message.invokeQueues();
|
| + }
|
| + return true;
|
| + };
|
| +
|
| + /**
|
| + * Handles document load completion tasks. Invoked from
|
| + * [WKNavigationDelegate webView:didFinishNavigation:], when document load is
|
| + * complete.
|
| + */
|
| + __gCrWeb.didFinishNavigation = function() {
|
| + // Send the favicons to the browser.
|
| + __gCrWeb.message.invokeOnHost({'command': 'document.favicons',
|
| + 'favicons': __gCrWeb.common.getFavicons()});
|
| + // Add placeholders for plugin content.
|
| + if (__gCrWeb.common.updatePluginPlaceholders())
|
| + __gCrWeb.message.invokeOnHost({'command': 'addPluginPlaceholders'});
|
| + }
|
| +
|
| + /**
|
| + * Sends window.history.willChangeState message. Called when
|
| + * history.pushState and history.replaceState are invoked.
|
| + */
|
| + __gCrWeb.core_dynamic.historyWillChangeState = function() {
|
| + __gCrWeb.message.invokeOnHost(
|
| + {'command': 'window.history.willChangeState'});
|
| + };
|
| +}
|
|
|