| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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 "chrome/browser/tab_contents/tab_contents_observer.h" | |
| 6 | |
| 7 #include "chrome/browser/renderer_host/render_view_host.h" | |
| 8 #include "chrome/browser/tab_contents/tab_contents.h" | |
| 9 | |
| 10 TabContentsObserver::TabContentsObserver(TabContents* tab_contents) | |
| 11 : tab_contents_(tab_contents), | |
| 12 routing_id_(tab_contents->render_view_host()->routing_id()) { | |
| 13 tab_contents_->AddObserver(this); | |
| 14 } | |
| 15 | |
| 16 TabContentsObserver::~TabContentsObserver() { | |
| 17 if (tab_contents_) | |
| 18 tab_contents_->RemoveObserver(this); | |
| 19 } | |
| 20 | |
| 21 bool TabContentsObserver::OnMessageReceived(const IPC::Message& message) { | |
| 22 return false; | |
| 23 } | |
| 24 | |
| 25 bool TabContentsObserver::Send(IPC::Message* message) { | |
| 26 if (!tab_contents_->render_view_host()) { | |
| 27 delete message; | |
| 28 return false; | |
| 29 } | |
| 30 | |
| 31 return tab_contents_->render_view_host()->Send(message); | |
| 32 } | |
| OLD | NEW |