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/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" |
| 14 #include "content/public/browser/render_view_host_observer.h" |
| 15 #include "ipc/ipc_channel_handle.h" |
| 16 #include "ipc/ipc_sync_message.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 18 #include "ui/surface/transport_dib.h" |
| 19 #include "webkit/glue/webcursor.h" |
| 20 |
| 21 namespace gfx { |
| 22 class Size; |
| 23 } |
| 24 |
| 25 struct BrowserPluginHostMsg_ResizeGuest_Params; |
| 26 struct ViewHostMsg_UpdateRect_Params; |
| 27 |
| 28 namespace content { |
| 29 |
| 30 class RenderViewHost; |
| 31 |
| 32 // Helper for browser plugin embedder. |
| 33 // A lot of messages coming from guests need to know the guest's RenderViewHost. |
| 34 // BrowserPluginEmbedderHelper handles BrowserPluginHostMsg messages and |
| 35 // relays them with their associated RenderViewHosts to its delegate where they |
| 36 // will be handled. |
| 37 class BrowserPluginEmbedderHelper : public RenderViewHostObserver, |
| 38 public NotificationObserver { |
| 39 public: |
| 40 BrowserPluginEmbedderHelper(BrowserPluginEmbedder* embedder, |
| 41 WebContentsImpl* web_contents, |
| 42 RenderViewHost* render_view_host); |
| 43 virtual ~BrowserPluginEmbedderHelper(); |
| 44 |
| 45 // Make it public for sync IPCs. |
| 46 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 47 |
| 48 private: |
| 49 // Message handlers. |
| 50 void OnNavigateGuest(int instance_id, |
| 51 int64 frame_id, |
| 52 const std::string& src, |
| 53 const gfx::Size& size); |
| 54 void OnResizeGuest(int instance_id, |
| 55 const BrowserPluginHostMsg_ResizeGuest_Params& params); |
| 56 void OnUpdateRectACK(int instance_id, int message_id, const gfx::Size& size); |
| 57 void OnHandleInputEvent(const IPC::SyncMessage& message, bool* handled); |
| 58 void OnSetFocus(int instance_id, bool focused); |
| 59 void OnPluginDestroyed(int instance_id); |
| 60 |
| 61 // RenderViewHostObserver implementation. |
| 62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 63 |
| 64 // NotificationObserver method override. |
| 65 virtual void Observe(int type, |
| 66 const NotificationSource& source, |
| 67 const NotificationDetails& details) OVERRIDE; |
| 68 |
| 69 BrowserPluginEmbedder* embedder_; |
| 70 // A scoped container for notification registries. |
| 71 NotificationRegistrar registrar_; |
| 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedderHelper); |
| 74 }; |
| 75 |
| 76 } // namespace content |
| 77 |
| 78 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_HELPER_H_ |
OLD | NEW |