summaryrefslogtreecommitdiffstats
path: root/android_webview/renderer
diff options
context:
space:
mode:
authorbenm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-27 23:35:06 +0000
committerbenm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-27 23:35:06 +0000
commit6ec278727a8860a3f411c183f6601538de540718 (patch)
tree00251994cefcd474528c9f0a3ff3ec5cd1066328 /android_webview/renderer
parent6bf9fd99b7664858b4cd8841d55a2cef2eec7cc1 (diff)
downloadchromium_src-6ec278727a8860a3f411c183f6601538de540718.zip
chromium_src-6ec278727a8860a3f411c183f6601538de540718.tar.gz
chromium_src-6ec278727a8860a3f411c183f6601538de540718.tar.bz2
[Android WebView] Add an API to toggle the JS navigator.online property
BUG=279929 Review URL: https://chromiumcodereview.appspot.com/22986033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219854 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/renderer')
-rw-r--r--android_webview/renderer/aw_render_process_observer.cc7
-rw-r--r--android_webview/renderer/aw_render_process_observer.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/android_webview/renderer/aw_render_process_observer.cc b/android_webview/renderer/aw_render_process_observer.cc
index 5e3ecca..561580c 100644
--- a/android_webview/renderer/aw_render_process_observer.cc
+++ b/android_webview/renderer/aw_render_process_observer.cc
@@ -7,6 +7,7 @@
#include "android_webview/common/render_view_messages.h"
#include "ipc/ipc_message_macros.h"
#include "third_party/WebKit/public/web/WebCache.h"
+#include "third_party/WebKit/public/web/WebNetworkStateNotifier.h"
namespace android_webview {
@@ -22,6 +23,7 @@ bool AwRenderProcessObserver::OnControlMessageReceived(
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AwRenderProcessObserver, message)
IPC_MESSAGE_HANDLER(AwViewMsg_ClearCache, OnClearCache)
+ IPC_MESSAGE_HANDLER(AwViewMsg_SetJsOnlineProperty, OnSetJsOnlineProperty)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -36,4 +38,9 @@ void AwRenderProcessObserver::OnClearCache() {
WebKit::WebCache::clear();
}
+void AwRenderProcessObserver::OnSetJsOnlineProperty(bool network_up) {
+ if (webkit_initialized_)
+ WebKit::WebNetworkStateNotifier::setOnLine(network_up);
+}
+
} // nanemspace android_webview
diff --git a/android_webview/renderer/aw_render_process_observer.h b/android_webview/renderer/aw_render_process_observer.h
index 5a5a8f9..2cb4d2f 100644
--- a/android_webview/renderer/aw_render_process_observer.h
+++ b/android_webview/renderer/aw_render_process_observer.h
@@ -24,6 +24,7 @@ class AwRenderProcessObserver : public content::RenderProcessObserver {
private:
void OnClearCache();
+ void OnSetJsOnlineProperty(bool network_up);
bool webkit_initialized_;
};