| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // 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 | 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 "content/public/browser/web_contents_observer.h" | 5 #include "content/public/browser/web_contents_observer.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_view_host.h" | 7 #include "content/browser/renderer_host/render_view_host.h" |
| 8 #include "content/browser/tab_contents/tab_contents.h" | 8 #include "content/browser/tab_contents/tab_contents.h" |
| 9 #include "content/public/browser/navigation_details.h" | 9 #include "content/public/browser/navigation_details.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 40 bool WebContentsObserver::OnMessageReceived(const IPC::Message& message) { | 40 bool WebContentsObserver::OnMessageReceived(const IPC::Message& message) { |
| 41 return false; | 41 return false; |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool WebContentsObserver::Send(IPC::Message* message) { | 44 bool WebContentsObserver::Send(IPC::Message* message) { |
| 45 if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) { | 45 if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) { |
| 46 delete message; | 46 delete message; |
| 47 return false; | 47 return false; |
| 48 } | 48 } |
| 49 | 49 |
| 50 return tab_contents_->GetRenderViewHost()->Send(message); | 50 return static_cast<RenderViewHostImpl*>( |
| 51 tab_contents_->GetRenderViewHost())->Send(message); |
| 51 } | 52 } |
| 52 | 53 |
| 53 int WebContentsObserver::routing_id() const { | 54 int WebContentsObserver::routing_id() const { |
| 54 if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) | 55 if (!tab_contents_ || !tab_contents_->GetRenderViewHost()) |
| 55 return MSG_ROUTING_NONE; | 56 return MSG_ROUTING_NONE; |
| 56 | 57 |
| 57 return tab_contents_->GetRenderViewHost()->routing_id(); | 58 return tab_contents_->GetRenderViewHost()->GetRoutingID(); |
| 58 } | 59 } |
| 59 | 60 |
| 60 void WebContentsObserver::TabContentsDestroyed() { | 61 void WebContentsObserver::TabContentsDestroyed() { |
| 61 // Do cleanup so that 'this' can safely be deleted from WebContentsDestroyed. | 62 // Do cleanup so that 'this' can safely be deleted from WebContentsDestroyed. |
| 62 tab_contents_->RemoveObserver(this); | 63 tab_contents_->RemoveObserver(this); |
| 63 TabContents* tab = tab_contents_; | 64 TabContents* tab = tab_contents_; |
| 64 tab_contents_ = NULL; | 65 tab_contents_ = NULL; |
| 65 WebContentsDestroyed(tab); | 66 WebContentsDestroyed(tab); |
| 66 } | 67 } |
| 67 | 68 |
| 68 } // namespace content | 69 } // namespace content |
| OLD | NEW |