summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_view_observer.cc
blob: 7e771e3ab86d0183d7b32f00b2ab9911e59fb0c0 (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
// 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->routing_id()) {
  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;
}