blob: ab7d9d3a694b2dd41fb6cda92539616521317777 [file] [log] [blame]
[email protected]86b74e062012-10-03 01:44:461// 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.
4
5#include "android_webview/renderer/aw_render_process_observer.h"
6
7#include "android_webview/common/render_view_messages.h"
8#include "ipc/ipc_message_macros.h"
[email protected]a0962a92013-06-20 18:27:349#include "third_party/WebKit/public/web/WebCache.h"
[email protected]6ec27872013-08-27 23:35:0610#include "third_party/WebKit/public/web/WebNetworkStateNotifier.h"
[email protected]86b74e062012-10-03 01:44:4611
12namespace android_webview {
13
[email protected]8937e962012-10-05 03:23:0114AwRenderProcessObserver::AwRenderProcessObserver()
15 : webkit_initialized_(false) {
[email protected]86b74e062012-10-03 01:44:4616}
17
18AwRenderProcessObserver::~AwRenderProcessObserver() {
19}
20
21bool AwRenderProcessObserver::OnControlMessageReceived(
22 const IPC::Message& message) {
23 bool handled = true;
24 IPC_BEGIN_MESSAGE_MAP(AwRenderProcessObserver, message)
25 IPC_MESSAGE_HANDLER(AwViewMsg_ClearCache, OnClearCache)
[email protected]6ec27872013-08-27 23:35:0626 IPC_MESSAGE_HANDLER(AwViewMsg_SetJsOnlineProperty, OnSetJsOnlineProperty)
[email protected]86b74e062012-10-03 01:44:4627 IPC_MESSAGE_UNHANDLED(handled = false)
28 IPC_END_MESSAGE_MAP()
29 return handled;
30}
31
[email protected]8937e962012-10-05 03:23:0132void AwRenderProcessObserver::WebKitInitialized() {
33 webkit_initialized_ = true;
34}
35
[email protected]86b74e062012-10-03 01:44:4636void AwRenderProcessObserver::OnClearCache() {
[email protected]8937e962012-10-05 03:23:0137 if (webkit_initialized_)
[email protected]c32e27082013-11-07 06:58:2038 blink::WebCache::clear();
[email protected]86b74e062012-10-03 01:44:4639}
40
[email protected]6ec27872013-08-27 23:35:0641void AwRenderProcessObserver::OnSetJsOnlineProperty(bool network_up) {
42 if (webkit_initialized_)
[email protected]c32e27082013-11-07 06:58:2043 blink::WebNetworkStateNotifier::setOnLine(network_up);
[email protected]6ec27872013-08-27 23:35:0644}
45
[email protected]86b74e062012-10-03 01:44:4646} // nanemspace android_webview