blob: 9c9a4a82319b5bd9b94a951c1bc988e8a02f0a1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright (c) 2011 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.
#include "chrome/renderer/render_view_observer.h"
#include "chrome/renderer/render_view.h"
RenderViewObserver::RenderViewObserver(RenderView* render_view)
: render_view_(render_view),
routing_id_(render_view ? render_view->routing_id() : 0) {
// |render_view| can be NULL on unit testing.
if (render_view_)
render_view_->AddObserver(this);
}
RenderViewObserver::~RenderViewObserver() {
if (render_view_)
render_view_->RemoveObserver(this);
}
void RenderViewObserver::OnDestruct() {
delete this;
}
bool RenderViewObserver::OnMessageReceived(const IPC::Message& message) {
return false;
}
bool RenderViewObserver::Send(IPC::Message* message) {
if (render_view_)
return render_view_->Send(message);
delete message;
return false;
}
|