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