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
3 // found in the LICENSE file.
5 #include "android_webview/renderer/aw_render_process_observer.h"
7 #include "android_webview/common/render_view_messages.h"
8 #include "ipc/ipc_message_macros.h"
9 #include "third_party/WebKit/public/web/WebCache.h"
10 #include "third_party/WebKit/public/web/WebNetworkStateNotifier.h"
12 namespace android_webview
{
14 AwRenderProcessObserver::AwRenderProcessObserver()
15 : webkit_initialized_(false) {
18 AwRenderProcessObserver::~AwRenderProcessObserver() {
21 bool AwRenderProcessObserver::OnControlMessageReceived(
22 const IPC::Message
& message
) {
24 IPC_BEGIN_MESSAGE_MAP(AwRenderProcessObserver
, message
)
25 IPC_MESSAGE_HANDLER(AwViewMsg_ClearCache
, OnClearCache
)
26 IPC_MESSAGE_HANDLER(AwViewMsg_SetJsOnlineProperty
, OnSetJsOnlineProperty
)
27 IPC_MESSAGE_UNHANDLED(handled
= false)
32 void AwRenderProcessObserver::WebKitInitialized() {
33 webkit_initialized_
= true;
36 void AwRenderProcessObserver::OnClearCache() {
37 if (webkit_initialized_
)
38 blink::WebCache::clear();
41 void AwRenderProcessObserver::OnSetJsOnlineProperty(bool network_up
) {
42 if (webkit_initialized_
)
43 blink::WebNetworkStateNotifier::setOnLine(network_up
);
46 } // nanemspace android_webview