Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: content/browser/browser_plugin/browser_plugin_host_guest_delegate.h

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Fixed tests. Also fixed a case where UpdateRect was being sent from bp renderer before NavigateGues… Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_plugin/browser_plugin_host_guest_delegate.h
diff --git a/content/browser/browser_plugin/browser_plugin_host_guest_delegate.h b/content/browser/browser_plugin/browser_plugin_host_guest_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..e05ee2aadb73b14c8b6de54e7e99e0c54d99650f
--- /dev/null
+++ b/content/browser/browser_plugin/browser_plugin_host_guest_delegate.h
@@ -0,0 +1,117 @@
+// 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_GUEST_DELEGATE_H_
+#define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_DELEGATE_H_
+
+#include <string>
+#include <map>
+
+#include "base/compiler_specific.h"
+#include "base/id_map.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 "ui/gfx/rect.h"
+#include "ui/gfx/size.h"
+#include "webkit/glue/webcursor.h"
+
+namespace gfx {
+class Size;
+}
+
+struct BrowserPluginHostMsg_ResizeGuest_Params;
+struct ViewHostMsg_UpdateRect_Params;
+
+namespace content {
+
+class BrowserPluginHostEmbedderDelegate;
+class RenderProcessHost;
+
+// Delegate for browser plugin guest. It provides functionality to
rjkroege 2012/08/22 21:57:38 I like the language "WebContents operating in the
lazyboy 2012/08/23 00:45:22 Done. Also updated embedder's doc.
+// webcontents to act as an 'Guest', implements guest specific overrides for
+// ViewHostMsg_* messages.
+class BrowserPluginHostGuestDelegate : public WebContentsDelegate,
+ public WebContentsObserver {
+ public:
+ BrowserPluginHostGuestDelegate(int instance_id,
+ WebContentsImpl* web_contents);
+ virtual ~BrowserPluginHostGuestDelegate();
+
+ private:
+ friend class BrowserPluginHostEmbedderDelegate;
+ friend class BrowserPluginHostGuestRole;
+
+ void set_embedder_render_process_host(
+ RenderProcessHost* render_process_host) {
+ embedder_render_process_host_ = render_process_host;
+ }
+ RenderProcessHost* embedder_render_process_host() {
+ return embedder_render_process_host_;
+ }
+ int instance_id() const { return instance_id_; }
+
+ void SetDamageBuffer(TransportDIB* damage_buffer,
+ const gfx::Size& size,
+ float scale_factor);
+ TransportDIB* damage_buffer() const { return damage_buffer_; }
+ const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; }
+ float damage_buffer_scale_factor() const {
+ return damage_buffer_scale_factor_;
+ }
+
+ void UpdateRect(RenderViewHost* render_view_host,
+ const ViewHostMsg_UpdateRect_Params& params);
+ void UpdateRectACK(int message_id, const gfx::Size& size);
+ void HandleInputEvent(RenderViewHost* render_view_host,
+ const gfx::Rect& guest_rect,
+ const WebKit::WebInputEvent& event,
+ IPC::Message* reply_message);
+ void ShowWidget(RenderViewHost* render_view_host,
+ int route_id,
+ const gfx::Rect& initial_pos);
+ void SetFocus(bool focused);
+ void SetCursor(const WebCursor& cursor);
+ void HandleInputEventAck(RenderViewHost* render_view_host, bool handled);
+
+ void Destroy();
+
+ // WebContentsObserver implementation.
+ // Used to monitor frame navigation to cleanup itself up.
+ virtual void DidCommitProvisionalLoadForFrame(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& url,
+ PageTransition transition_type,
+ RenderViewHost* render_view_host) OVERRIDE;
+ virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
+
+ // WebContentsDelegate implementation.
+ virtual bool TakeFocus(bool reverse) OVERRIDE;
+ virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
+
+ RenderProcessHost* embedder_render_process_host_;
+ // An identifier that uniquely identifies a browser plugin container
+ // within an embedder.
+ int instance_id_;
+ TransportDIB* damage_buffer_;
+ gfx::Size damage_buffer_size_;
+ float damage_buffer_scale_factor_;
+ scoped_ptr<IPC::Message> pending_input_event_reply_;
+ gfx::Rect guest_rect_;
+ WebCursor cursor_;
+ IDMap<RenderViewHost> pending_updates_;
+ int pending_update_counter_;
+
+
+ DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostGuestDelegate);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698