Index: content/browser/browser_plugin/browser_plugin_host_embedder_delegate.h |
diff --git a/content/browser/browser_plugin/browser_plugin_host_embedder_delegate.h b/content/browser/browser_plugin/browser_plugin_host_embedder_delegate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d11bf4a7898485e5c15af0b690667c2ee4bd0a1a |
--- /dev/null |
+++ b/content/browser/browser_plugin/browser_plugin_host_embedder_delegate.h |
@@ -0,0 +1,95 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_DELEGATE_H_ |
+#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_DELEGATE_H_ |
+ |
+#include <string> |
+ |
+#include "base/compiler_specific.h" |
+#include "content/public/browser/render_view_host_observer.h" |
+#include "content/public/browser/web_contents_delegate.h" |
+#include "content/public/browser/web_contents_observer.h" |
+#include "ipc/ipc_channel_handle.h" |
+#include "ipc/ipc_sync_message.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
+#include "ui/surface/transport_dib.h" |
+#include "webkit/glue/webcursor.h" |
+ |
+namespace gfx { |
+class Size; |
+} |
+ |
+struct BrowserPluginHostMsg_ResizeGuest_Params; |
+struct ViewHostMsg_UpdateRect_Params; |
+ |
+namespace content { |
+ |
+class BrowserPluginHostGuestDelegate; |
+ |
+typedef std::map<WebContents*, int64> GuestMap; |
+typedef std::map<int, BrowserPluginHostGuestDelegate*> ContainerInstanceMap; |
+ |
+// Delegate for browser plugin embedder. It provides functionality to |
+// webcontents to act as an 'Embedder', manages list of guests inside the |
+// embedder. |
+class BrowserPluginHostEmbedderDelegate : public WebContentsObserver { |
+ public: |
+ BrowserPluginHostEmbedderDelegate(WebContentsImpl* web_contents); |
+ virtual ~BrowserPluginHostEmbedderDelegate(); |
+ |
+ 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.
|
+ return guests_by_instance_id_; |
+ } |
+ |
+ private: |
+ friend class BrowserPluginHostEmbedderRole; |
+ |
+ // Get a guest browser plugin delegate by its container ID specified |
+ // in BrowserPlugin. |
+ 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
|
+ 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.
|
+ int64 frame_id); |
+ void DestroyGuestByInstanceID(int instance_id); |
+ void DestroyGuests(); |
+ |
+ // Message handlers (direct/indirect via BrowserPluginHostEmbedderRole). |
+ void NavigateGuest(RenderViewHost* render_view_host, |
+ int instance_id, |
+ int64 frame_id, |
+ const std::string& src, |
+ const gfx::Size& size); |
+ void UpdateRectACK(int instance_id, int message_id, const gfx::Size& size); |
+ void SetFocus(int instance_id, bool focused); |
+ 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.
|
+ int height, bool resize_pending, float scale_factor); |
+ void WebContentsVisiblitlyChanged(bool visible); |
+ void HandleInputEvent(int instance_id, |
+ RenderViewHost* render_view_host, |
+ const gfx::Rect& guest_rect, |
+ const WebKit::WebInputEvent& event, |
+ IPC::Message* reply_message); |
+ void PluginDestroyed(int instance_id); |
+ |
+ // WebContentsObserver implementation. |
+ // Used to monitor frame navigation to cleanup guests when a frame navigates |
+ // away from the browser plugin it's hosting. |
+ virtual void DidCommitProvisionalLoadForFrame( |
+ int64 frame_id, |
+ bool is_main_frame, |
+ const GURL& url, |
+ PageTransition transition_type, |
+ RenderViewHost* render_view_host) OVERRIDE; |
+ virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; |
+ virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
+ |
+ GuestMap guests_; |
+ ContainerInstanceMap guests_by_instance_id_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostEmbedderDelegate); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_EMBEDDER_DELEGATE_H_ |