OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/tab_contents/tab_contents_observer.h" | 5 #include "content/browser/tab_contents/tab_contents_observer.h" |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_view_host.h" | 7 #include "chrome/browser/renderer_host/render_view_host.h" |
8 #include "chrome/browser/tab_contents/tab_contents.h" | 8 #include "content/browser/tab_contents/tab_contents.h" |
9 | 9 |
10 TabContentsObserver::TabContentsObserver(TabContents* tab_contents) | 10 TabContentsObserver::TabContentsObserver(TabContents* tab_contents) |
11 : tab_contents_(tab_contents), | 11 : tab_contents_(tab_contents), |
12 routing_id_(tab_contents->render_view_host()->routing_id()) { | 12 routing_id_(tab_contents->render_view_host()->routing_id()) { |
13 tab_contents_->AddObserver(this); | 13 tab_contents_->AddObserver(this); |
14 } | 14 } |
15 | 15 |
16 TabContentsObserver::~TabContentsObserver() { | 16 TabContentsObserver::~TabContentsObserver() { |
17 if (tab_contents_) | 17 if (tab_contents_) |
18 tab_contents_->RemoveObserver(this); | 18 tab_contents_->RemoveObserver(this); |
19 } | 19 } |
20 | 20 |
21 bool TabContentsObserver::OnMessageReceived(const IPC::Message& message) { | 21 bool TabContentsObserver::OnMessageReceived(const IPC::Message& message) { |
22 return false; | 22 return false; |
23 } | 23 } |
24 | 24 |
25 bool TabContentsObserver::Send(IPC::Message* message) { | 25 bool TabContentsObserver::Send(IPC::Message* message) { |
26 if (!tab_contents_->render_view_host()) { | 26 if (!tab_contents_->render_view_host()) { |
27 delete message; | 27 delete message; |
28 return false; | 28 return false; |
29 } | 29 } |
30 | 30 |
31 return tab_contents_->render_view_host()->Send(message); | 31 return tab_contents_->render_view_host()->Send(message); |
32 } | 32 } |
OLD | NEW |