OLD | NEW |
1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" | 7 #include "content/browser/web_contents/web_contents_impl.h" |
8 #include "content/public/browser/navigation_details.h" | 8 #include "content/public/browser/navigation_details.h" |
9 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 void WebContentsObserver::Observe(WebContents* web_contents) { | 31 void WebContentsObserver::Observe(WebContents* web_contents) { |
32 if (web_contents_) | 32 if (web_contents_) |
33 web_contents_->RemoveObserver(this); | 33 web_contents_->RemoveObserver(this); |
34 web_contents_ = static_cast<WebContentsImpl*>(web_contents); | 34 web_contents_ = static_cast<WebContentsImpl*>(web_contents); |
35 if (web_contents_) { | 35 if (web_contents_) { |
36 web_contents_->AddObserver(this); | 36 web_contents_->AddObserver(this); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 bool WebContentsObserver::RequestPpapiBrokerPermission( | |
41 WebContents* web_contents, | |
42 const GURL& url, | |
43 const FilePath& plugin_path, | |
44 const base::Callback<void(bool)>& callback) { | |
45 return false; | |
46 } | |
47 | |
48 bool WebContentsObserver::OnMessageReceived(const IPC::Message& message) { | 40 bool WebContentsObserver::OnMessageReceived(const IPC::Message& message) { |
49 return false; | 41 return false; |
50 } | 42 } |
51 | 43 |
52 bool WebContentsObserver::Send(IPC::Message* message) { | 44 bool WebContentsObserver::Send(IPC::Message* message) { |
53 if (!web_contents_) { | 45 if (!web_contents_) { |
54 delete message; | 46 delete message; |
55 return false; | 47 return false; |
56 } | 48 } |
57 | 49 |
58 return web_contents_->Send(message); | 50 return web_contents_->Send(message); |
59 } | 51 } |
60 | 52 |
61 int WebContentsObserver::routing_id() const { | 53 int WebContentsObserver::routing_id() const { |
62 if (!web_contents_) | 54 if (!web_contents_) |
63 return MSG_ROUTING_NONE; | 55 return MSG_ROUTING_NONE; |
64 | 56 |
65 return web_contents_->GetRoutingID(); | 57 return web_contents_->GetRoutingID(); |
66 } | 58 } |
67 | 59 |
68 void WebContentsObserver::WebContentsImplDestroyed() { | 60 void WebContentsObserver::WebContentsImplDestroyed() { |
69 // Do cleanup so that 'this' can safely be deleted from WebContentsDestroyed. | 61 // Do cleanup so that 'this' can safely be deleted from WebContentsDestroyed. |
70 web_contents_->RemoveObserver(this); | 62 web_contents_->RemoveObserver(this); |
71 WebContentsImpl* contents = web_contents_; | 63 WebContentsImpl* contents = web_contents_; |
72 web_contents_ = NULL; | 64 web_contents_ = NULL; |
73 WebContentsDestroyed(contents); | 65 WebContentsDestroyed(contents); |
74 } | 66 } |
75 | 67 |
76 } // namespace content | 68 } // namespace content |
OLD | NEW |