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_DELEGATE_H_ | |
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_DELEGATE_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "content/public/browser/render_view_host_observer.h" | |
12 #include "content/public/browser/web_contents_delegate.h" | |
13 #include "content/public/browser/web_contents_observer.h" | |
14 #include "ipc/ipc_channel_handle.h" | |
15 #include "ipc/ipc_sync_message.h" | |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | |
17 #include "ui/surface/transport_dib.h" | |
18 #include "webkit/glue/webcursor.h" | |
19 | |
20 namespace gfx { | |
21 class Size; | |
22 } | |
23 | |
24 struct BrowserPluginHostMsg_ResizeGuest_Params; | |
25 struct ViewHostMsg_UpdateRect_Params; | |
26 | |
27 namespace content { | |
28 | |
29 class BrowserPluginHostGuestDelegate; | |
30 | |
31 typedef std::map<WebContents*, int64> GuestMap; | |
32 typedef std::map<int, BrowserPluginHostGuestDelegate*> ContainerInstanceMap; | |
33 | |
34 // Delegate for browser plugin embedder. It provides functionality to | |
35 // webcontents to act as an 'Embedder', manages list of guests inside the | |
36 // embedder. | |
37 class BrowserPluginHostEmbedderDelegate : public WebContentsObserver { | |
38 public: | |
39 BrowserPluginHostEmbedderDelegate(WebContentsImpl* web_contents); | |
40 virtual ~BrowserPluginHostEmbedderDelegate(); | |
41 | |
42 const ContainerInstanceMap& guests_for_testing() const { | |
rjkroege
2012/08/22 21:57:38
I think it's better to expose testing interfaces b
lazyboy
2012/08/23 00:45:22
I actually tried that first, doesn't seem to work.
| |
43 return guests_by_instance_id_; | |
44 } | |
45 | |
46 private: | |
47 friend class BrowserPluginHostEmbedderRole; | |
48 | |
49 // Get a guest browser plugin delegate by its container ID specified | |
50 // in BrowserPlugin. | |
51 BrowserPluginHostGuestDelegate * GetGuestByInstanceID(int instance_id) const; | |
rjkroege
2012/08/22 21:57:38
no space before the *
And we should have a few co
lazyboy
2012/08/23 00:45:22
Added comments for some of the methods here that s
| |
52 void AddGuest(int instance_id, BrowserPluginHostGuestDelegate* guest, | |
rjkroege
2012/08/22 21:57:38
all params on different lines
lazyboy
2012/08/23 00:45:22
Done.
| |
53 int64 frame_id); | |
54 void DestroyGuestByInstanceID(int instance_id); | |
55 void DestroyGuests(); | |
56 | |
57 // Message handlers (direct/indirect via BrowserPluginHostEmbedderRole). | |
58 void NavigateGuest(RenderViewHost* render_view_host, | |
59 int instance_id, | |
60 int64 frame_id, | |
61 const std::string& src, | |
62 const gfx::Size& size); | |
63 void UpdateRectACK(int instance_id, int message_id, const gfx::Size& size); | |
64 void SetFocus(int instance_id, bool focused); | |
65 void ResizeGuest(int instance_id, TransportDIB* damage_buffer, int width, | |
rjkroege
2012/08/22 21:57:38
all params on different lines
lazyboy
2012/08/23 00:45:22
Done.
| |
66 int height, bool resize_pending, float scale_factor); | |
67 void WebContentsVisiblitlyChanged(bool visible); | |
68 void HandleInputEvent(int instance_id, | |
69 RenderViewHost* render_view_host, | |
70 const gfx::Rect& guest_rect, | |
71 const WebKit::WebInputEvent& event, | |
72 IPC::Message* reply_message); | |
73 void PluginDestroyed(int instance_id); | |
74 | |
75 // WebContentsObserver implementation. | |
76 // Used to monitor frame navigation to cleanup guests when a frame navigates | |
77 // away from the browser plugin it's hosting. | |
78 virtual void DidCommitProvisionalLoadForFrame( | |
79 int64 frame_id, | |
80 bool is_main_frame, | |
81 const GURL& url, | |
82 PageTransition transition_type, | |
83 RenderViewHost* render_view_host) OVERRIDE; | |
84 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; | |
85 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | |
86 | |
87 GuestMap guests_; | |
88 ContainerInstanceMap guests_by_instance_id_; | |
89 | |
90 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostEmbedderDelegate); | |
91 }; | |
92 | |
93 } // namespace content | |
94 | |
95 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_DELEGATE_ H_ | |
OLD | NEW |