Chromium Code Reviews| 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_GUEST_HELPER_H_ | |
| 6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_HELPER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "content/browser/browser_plugin/browser_plugin_guest.h" | |
| 12 #include "content/public/browser/render_view_host_observer.h" | |
| 13 #include "content/public/browser/notification_observer.h" | |
| 14 #include "content/public/browser/web_contents_observer.h" | |
| 15 #include "content/public/browser/notification_registrar.h" | |
| 16 #include "ipc/ipc_channel_handle.h" | |
| 17 #include "ipc/ipc_sync_message.h" | |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | |
| 19 #include "ui/surface/transport_dib.h" | |
| 20 #include "webkit/glue/webcursor.h" | |
| 21 | |
| 22 namespace gfx { | |
| 23 class Size; | |
| 24 } | |
| 25 | |
| 26 struct BrowserPluginHostMsg_ResizeGuest_Params; | |
| 27 struct ViewHostMsg_UpdateRect_Params; | |
| 28 | |
| 29 namespace content { | |
| 30 | |
| 31 class RenderViewHost; | |
| 32 | |
| 33 // Helper for browser plugin guest. | |
| 34 // | |
| 35 // It overrides different WebContents messages that require special treatment | |
| 36 // for a WebContents to act as a guest. All functionality is handled by its | |
| 37 // delegate. This class exists so we have separation of messages requiring | |
| 38 // special handling, which can be move to a message filter (IPC thread) for | |
|
Charlie Reis
2012/09/13 00:51:44
nit: move -> moved
lazyboy
2012/09/13 15:56:24
Done.
| |
| 39 // future optimization. | |
| 40 // | |
| 41 // The lifetime of this class is managed by the associated RenderViewHost. A | |
| 42 // BrowserPluginGuestHelper is created whenever a BrowserPluginGuest is created. | |
| 43 class BrowserPluginGuestHelper : public RenderViewHostObserver { | |
| 44 public: | |
| 45 BrowserPluginGuestHelper(BrowserPluginGuest* guest, | |
| 46 RenderViewHost* render_view_host); | |
| 47 virtual ~BrowserPluginGuestHelper(); | |
| 48 | |
| 49 protected: | |
| 50 // RenderViewHostObserver implementation. | |
| 51 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 52 | |
| 53 private: | |
| 54 // Message handlers | |
| 55 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); | |
| 56 void OnHandleInputEventAck(WebKit::WebInputEvent::Type event_type, | |
| 57 bool processed); | |
| 58 void OnTakeFocus(bool reverse); | |
| 59 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); | |
| 60 void OnSetCursor(const WebCursor& cursor); | |
| 61 | |
| 62 BrowserPluginGuest* guest_; | |
| 63 // A scoped container for notification registries. | |
| 64 NotificationRegistrar registrar_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuestHelper); | |
| 67 }; | |
| 68 | |
| 69 } // namespace content | |
| 70 | |
| 71 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_HELPER_H_ | |
| OLD | NEW |