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_HOST_EMBEDDER_ROLE_H_ | |
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_ROLE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "content/browser/browser_plugin/browser_plugin_host_embedder_delegate.h " | |
12 #include "content/browser/browser_plugin/browser_plugin_host_role.h" | |
13 #include "content/public/browser/notification_observer.h" | |
14 #include "content/public/browser/notification_registrar.h" | |
15 #include "content/public/browser/render_view_host_observer.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 // Role for browser plugin embedder. A lot of messages coming from guests need | |
rjkroege
2012/08/22 21:57:38
This description needs to be better.
Having an in
lazyboy
2012/08/23 00:45:22
Done.
| |
34 // to know the guest's RenderViewHost. BrowserPluginHostEmbedderRole handles | |
35 // BrowserPluginHostMsg messages and relays them with their associated | |
36 // RenderViewHosts to its delegate where they will be handled. | |
37 class BrowserPluginHostEmbedderRole : public BrowserPluginHostRole, | |
38 public RenderViewHostObserver, | |
39 public NotificationObserver { | |
40 public: | |
41 BrowserPluginHostEmbedderRole(WebContentsImpl* web_contents, | |
42 RenderViewHost* render_view_host); | |
43 virtual ~BrowserPluginHostEmbedderRole(); | |
44 | |
45 // Make it public for sync IPCs. | |
46 virtual bool Send(IPC::Message* message) OVERRIDE; | |
47 void NavigateGuest(int instance_id, int64 frame_id, const std::string& src, | |
48 const gfx::Size& size); | |
49 BrowserPluginHostEmbedderDelegate* GetDelegate() { | |
50 return delegate_.get(); | |
51 } | |
52 | |
53 private: | |
54 void OnNavigateGuest(int instance_id, int64 frame_id, const std::string& src, | |
55 const gfx::Size& size); | |
56 void OnResizeGuest(int instance_id, | |
57 const BrowserPluginHostMsg_ResizeGuest_Params& params); | |
58 void OnUpdateRectACK(int instance_id, int message_id, const gfx::Size& size); | |
59 void OnHandleInputEvent(const IPC::SyncMessage& message, bool* handled); | |
60 void OnSetFocus(int instance_id, bool focused); | |
61 void OnPluginDestroyed(int instance_id); | |
62 | |
63 // RenderViewHostObserver implementation. | |
64 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
65 | |
66 // NotificationObserver method override. | |
67 virtual void Observe(int type, | |
68 const NotificationSource& source, | |
69 const NotificationDetails& details) OVERRIDE; | |
70 | |
71 scoped_ptr<BrowserPluginHostEmbedderDelegate> delegate_; | |
72 // A scoped container for notification registries. | |
73 NotificationRegistrar registrar_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostEmbedderRole); | |
76 }; | |
77 | |
78 } // namespace content | |
79 | |
80 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_ROLE_H_ | |
OLD | NEW |