OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_HELPER_H__ |
| 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_HELPER_H__ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "content/public/browser/render_view_host_observer.h" |
| 12 #include "ipc/ipc_channel_handle.h" |
| 13 #include "ipc/ipc_sync_message.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 15 #include "ui/surface/transport_dib.h" |
| 16 #include "webkit/glue/webcursor.h" |
| 17 |
| 18 namespace gfx { |
| 19 class Size; |
| 20 } |
| 21 |
| 22 struct BrowserPluginHostMsg_ResizeGuest_Params; |
| 23 struct ViewHostMsg_UpdateRect_Params; |
| 24 |
| 25 namespace content { |
| 26 |
| 27 class BrowserPluginHost; |
| 28 |
| 29 // This class acts as a plumber helper for BrowserPluginHost. A lot |
| 30 // of messages coming from guests need to know the guest's RenderViewHost. |
| 31 // BrowserPluginHostHelper handles BrowserPluginHost messages and relays |
| 32 // them with their associated RenderViewHosts to BrowserPluginHost where they |
| 33 // will be handled. |
| 34 class BrowserPluginHostHelper : public RenderViewHostObserver { |
| 35 public: |
| 36 BrowserPluginHostHelper(BrowserPluginHost* browser_plugin_host, |
| 37 RenderViewHost* render_view_host); |
| 38 virtual ~BrowserPluginHostHelper(); |
| 39 |
| 40 // Make it public for sync IPCs. |
| 41 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 42 private: |
| 43 void OnNavigateGuest(int instance_id, |
| 44 long long frame_id, |
| 45 const std::string& src, |
| 46 const gfx::Size& size); |
| 47 void OnResizeGuest(int instance_id, |
| 48 const BrowserPluginHostMsg_ResizeGuest_Params& params); |
| 49 void OnUpdateRectACK(int instance_id, |
| 50 int message_id, |
| 51 const gfx::Size& size); |
| 52 void OnHandleInputEvent(const IPC::SyncMessage& message, bool* handled); |
| 53 void OnSetFocus(int instance_id, bool focused); |
| 54 void OnPluginDestroyed(int instance_id); |
| 55 |
| 56 // Intercepted from the guest renderer process. |
| 57 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); |
| 58 void OnHandleInputEventAck(WebKit::WebInputEvent::Type event_type, |
| 59 bool processed); |
| 60 void OnTakeFocus(bool reverse); |
| 61 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); |
| 62 void OnSetCursor(const WebCursor& cursor); |
| 63 |
| 64 // RenderViewHostObserver implementation. |
| 65 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 66 |
| 67 BrowserPluginHost* browser_plugin_host_; |
| 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostHelper); |
| 70 }; |
| 71 |
| 72 |
| 73 } // namespace content |
| 74 |
| 75 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_OLD_BROWSER_PLUGIN_HOST_HELPER_H__ |
| 76 |
OLD | NEW |