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