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/renderer/browser_plugin/browser_plugin_manager_impl.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_manager_impl.h" |
6 | 6 |
7 #include "content/common/browser_plugin_messages.h" | 7 #include "content/common/browser_plugin_messages.h" |
8 #include "content/renderer/browser_plugin/browser_plugin.h" | 8 #include "content/renderer/browser_plugin/browser_plugin.h" |
9 #include "content/renderer/render_thread_impl.h" | 9 #include "content/renderer/render_thread_impl.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 PickleIterator iter(message); | 42 PickleIterator iter(message); |
43 bool success = iter.ReadInt(&instance_id); | 43 bool success = iter.ReadInt(&instance_id); |
44 DCHECK(success); | 44 DCHECK(success); |
45 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); | 45 BrowserPlugin* plugin = GetBrowserPlugin(instance_id); |
46 if (plugin && plugin->OnMessageReceived(message)) | 46 if (plugin && plugin->OnMessageReceived(message)) |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 bool handled = true; | 50 bool handled = true; |
51 IPC_BEGIN_MESSAGE_MAP(BrowserPluginManagerImpl, message) | 51 IPC_BEGIN_MESSAGE_MAP(BrowserPluginManagerImpl, message) |
| 52 IPC_MESSAGE_HANDLER(BrowserPluginMsg_BuffersSwapped, |
| 53 OnUnhandledSwap); |
52 IPC_MESSAGE_HANDLER(BrowserPluginMsg_PluginAtPositionRequest, | 54 IPC_MESSAGE_HANDLER(BrowserPluginMsg_PluginAtPositionRequest, |
53 OnPluginAtPositionRequest); | 55 OnPluginAtPositionRequest); |
54 IPC_MESSAGE_UNHANDLED(handled = false) | 56 IPC_MESSAGE_UNHANDLED(handled = false) |
55 IPC_END_MESSAGE_MAP() | 57 IPC_END_MESSAGE_MAP() |
56 return handled; | 58 return handled; |
57 } | 59 } |
58 | 60 |
59 void BrowserPluginManagerImpl::OnPluginAtPositionRequest( | 61 void BrowserPluginManagerImpl::OnPluginAtPositionRequest( |
60 const IPC::Message& message, | 62 const IPC::Message& message, |
61 int request_id, | 63 int request_id, |
(...skipping 15 matching lines...) Expand all Loading... |
77 it.Advance(); | 79 it.Advance(); |
78 } | 80 } |
79 | 81 |
80 Send(new BrowserPluginHostMsg_PluginAtPositionResponse( | 82 Send(new BrowserPluginHostMsg_PluginAtPositionResponse( |
81 source_routing_id, | 83 source_routing_id, |
82 instance_id, | 84 instance_id, |
83 request_id, | 85 request_id, |
84 local_position)); | 86 local_position)); |
85 } | 87 } |
86 | 88 |
| 89 void BrowserPluginManagerImpl::OnUnhandledSwap(const IPC::Message& message, |
| 90 int instance_id, |
| 91 const gfx::Size& size, |
| 92 std::string mailbox_name, |
| 93 int gpu_route_id, |
| 94 int gpu_host_id) { |
| 95 // After the BrowserPlugin object sends a destroy message to the |
| 96 // guest, it goes away and is unable to handle messages that |
| 97 // might still be coming from the guest. |
| 98 // In this case, we might receive a BuffersSwapped message that |
| 99 // we need to ACK. |
| 100 // Issue is tracked in crbug.com/170745. |
| 101 Send(new BrowserPluginHostMsg_BuffersSwappedACK( |
| 102 message.routing_id(), |
| 103 gpu_route_id, |
| 104 gpu_host_id, |
| 105 mailbox_name, |
| 106 0)); |
| 107 } |
| 108 |
87 // static | 109 // static |
88 bool BrowserPluginManagerImpl::ShouldForwardToBrowserPlugin( | 110 bool BrowserPluginManagerImpl::ShouldForwardToBrowserPlugin( |
89 const IPC::Message& message) { | 111 const IPC::Message& message) { |
90 switch (message.type()) { | 112 switch (message.type()) { |
91 case BrowserPluginMsg_AdvanceFocus::ID: | 113 case BrowserPluginMsg_AdvanceFocus::ID: |
92 case BrowserPluginMsg_GuestContentWindowReady::ID: | 114 case BrowserPluginMsg_GuestContentWindowReady::ID: |
93 case BrowserPluginMsg_GuestGone::ID: | 115 case BrowserPluginMsg_GuestGone::ID: |
94 case BrowserPluginMsg_GuestResponsive::ID: | 116 case BrowserPluginMsg_GuestResponsive::ID: |
95 case BrowserPluginMsg_GuestUnresponsive::ID: | 117 case BrowserPluginMsg_GuestUnresponsive::ID: |
96 case BrowserPluginMsg_LoadAbort::ID: | 118 case BrowserPluginMsg_LoadAbort::ID: |
97 case BrowserPluginMsg_LoadCommit::ID: | 119 case BrowserPluginMsg_LoadCommit::ID: |
98 case BrowserPluginMsg_LoadRedirect::ID: | 120 case BrowserPluginMsg_LoadRedirect::ID: |
99 case BrowserPluginMsg_LoadStart::ID: | 121 case BrowserPluginMsg_LoadStart::ID: |
100 case BrowserPluginMsg_LoadStop::ID: | 122 case BrowserPluginMsg_LoadStop::ID: |
101 case BrowserPluginMsg_SetCursor::ID: | 123 case BrowserPluginMsg_SetCursor::ID: |
102 case BrowserPluginMsg_ShouldAcceptTouchEvents::ID: | 124 case BrowserPluginMsg_ShouldAcceptTouchEvents::ID: |
103 case BrowserPluginMsg_UpdatedName::ID: | 125 case BrowserPluginMsg_UpdatedName::ID: |
104 case BrowserPluginMsg_UpdateRect::ID: | 126 case BrowserPluginMsg_UpdateRect::ID: |
105 case BrowserPluginMsg_BuffersSwapped::ID: | 127 case BrowserPluginMsg_BuffersSwapped::ID: |
106 return true; | 128 return true; |
107 default: | 129 default: |
108 break; | 130 break; |
109 } | 131 } |
110 return false; | 132 return false; |
111 } | 133 } |
112 | 134 |
113 } // namespace content | 135 } // namespace content |
OLD | NEW |