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_EMBEDDER_HELPER_H_ |
| 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_HELPER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
| 12 #include "content/public/browser/render_view_host_observer.h" |
| 13 #include "ipc/ipc_channel_handle.h" |
| 14 #include "ipc/ipc_sync_message.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 16 #include "ui/surface/transport_dib.h" |
| 17 #include "webkit/glue/webcursor.h" |
| 18 |
| 19 namespace gfx { |
| 20 class Size; |
| 21 } |
| 22 |
| 23 struct BrowserPluginHostMsg_ResizeGuest_Params; |
| 24 struct ViewHostMsg_UpdateRect_Params; |
| 25 |
| 26 namespace content { |
| 27 |
| 28 class RenderViewHost; |
| 29 |
| 30 // Helper for browser plugin embedder. |
| 31 // |
| 32 // A lot of messages coming from guests need to know the guest's RenderViewHost. |
| 33 // BrowserPluginEmbedderHelper handles BrowserPluginHostMsg messages and |
| 34 // relays them with their associated RenderViewHosts to its delegate where they |
| 35 // will be handled. |
| 36 // |
| 37 // A BrowserPluginEmbedderHelper is created whenever a BrowserPluginEmbedder is |
| 38 // created. BrowserPluginEmbedder's lifetime is managed by the associated |
| 39 // RenderViewHost. Functions in this class is assumed to be run on UI thread. |
| 40 class BrowserPluginEmbedderHelper : public RenderViewHostObserver { |
| 41 public: |
| 42 BrowserPluginEmbedderHelper(BrowserPluginEmbedder* embedder, |
| 43 RenderViewHost* render_view_host); |
| 44 virtual ~BrowserPluginEmbedderHelper(); |
| 45 |
| 46 // Make it public for sync IPCs. |
| 47 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 48 |
| 49 protected: |
| 50 // RenderViewHostObserver implementation. |
| 51 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 52 |
| 53 private: |
| 54 // Message handlers. |
| 55 void OnNavigateGuest(int instance_id, |
| 56 int64 frame_id, |
| 57 const std::string& src, |
| 58 const gfx::Size& size); |
| 59 void OnResizeGuest(int instance_id, |
| 60 const BrowserPluginHostMsg_ResizeGuest_Params& params); |
| 61 void OnUpdateRectACK(int instance_id, int message_id, const gfx::Size& size); |
| 62 void OnHandleInputEvent(const IPC::SyncMessage& message, bool* handled); |
| 63 void OnSetFocus(int instance_id, bool focused); |
| 64 void OnPluginDestroyed(int instance_id); |
| 65 |
| 66 BrowserPluginEmbedder* embedder_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedderHelper); |
| 69 }; |
| 70 |
| 71 } // namespace content |
| 72 |
| 73 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_HELPER_H_ |
OLD | NEW |