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

Side by Side 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 unified diff | Download patch
OLDNEW
(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_GUEST_DELEGATE_H_
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_DELEGATE_H_
7
8 #include <string>
9 #include <map>
10
11 #include "base/compiler_specific.h"
12 #include "base/id_map.h"
13 #include "content/public/browser/render_view_host_observer.h"
14 #include "content/public/browser/web_contents_delegate.h"
15 #include "content/public/browser/web_contents_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 "ui/gfx/rect.h"
21 #include "ui/gfx/size.h"
22 #include "webkit/glue/webcursor.h"
23
24 namespace gfx {
25 class Size;
26 }
27
28 struct BrowserPluginHostMsg_ResizeGuest_Params;
29 struct ViewHostMsg_UpdateRect_Params;
30
31 namespace content {
32
33 class BrowserPluginHostEmbedderDelegate;
34 class RenderProcessHost;
35
36 // 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.
37 // webcontents to act as an 'Guest', implements guest specific overrides for
38 // ViewHostMsg_* messages.
39 class BrowserPluginHostGuestDelegate : public WebContentsDelegate,
40 public WebContentsObserver {
41 public:
42 BrowserPluginHostGuestDelegate(int instance_id,
43 WebContentsImpl* web_contents);
44 virtual ~BrowserPluginHostGuestDelegate();
45
46 private:
47 friend class BrowserPluginHostEmbedderDelegate;
48 friend class BrowserPluginHostGuestRole;
49
50 void set_embedder_render_process_host(
51 RenderProcessHost* render_process_host) {
52 embedder_render_process_host_ = render_process_host;
53 }
54 RenderProcessHost* embedder_render_process_host() {
55 return embedder_render_process_host_;
56 }
57 int instance_id() const { return instance_id_; }
58
59 void SetDamageBuffer(TransportDIB* damage_buffer,
60 const gfx::Size& size,
61 float scale_factor);
62 TransportDIB* damage_buffer() const { return damage_buffer_; }
63 const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; }
64 float damage_buffer_scale_factor() const {
65 return damage_buffer_scale_factor_;
66 }
67
68 void UpdateRect(RenderViewHost* render_view_host,
69 const ViewHostMsg_UpdateRect_Params& params);
70 void UpdateRectACK(int message_id, const gfx::Size& size);
71 void HandleInputEvent(RenderViewHost* render_view_host,
72 const gfx::Rect& guest_rect,
73 const WebKit::WebInputEvent& event,
74 IPC::Message* reply_message);
75 void ShowWidget(RenderViewHost* render_view_host,
76 int route_id,
77 const gfx::Rect& initial_pos);
78 void SetFocus(bool focused);
79 void SetCursor(const WebCursor& cursor);
80 void HandleInputEventAck(RenderViewHost* render_view_host, bool handled);
81
82 void Destroy();
83
84 // WebContentsObserver implementation.
85 // Used to monitor frame navigation to cleanup itself up.
86 virtual void DidCommitProvisionalLoadForFrame(
87 int64 frame_id,
88 bool is_main_frame,
89 const GURL& url,
90 PageTransition transition_type,
91 RenderViewHost* render_view_host) OVERRIDE;
92 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
93
94 // WebContentsDelegate implementation.
95 virtual bool TakeFocus(bool reverse) OVERRIDE;
96 virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
97
98 RenderProcessHost* embedder_render_process_host_;
99 // An identifier that uniquely identifies a browser plugin container
100 // within an embedder.
101 int instance_id_;
102 TransportDIB* damage_buffer_;
103 gfx::Size damage_buffer_size_;
104 float damage_buffer_scale_factor_;
105 scoped_ptr<IPC::Message> pending_input_event_reply_;
106 gfx::Rect guest_rect_;
107 WebCursor cursor_;
108 IDMap<RenderViewHost> pending_updates_;
109 int pending_update_counter_;
110
111
112 DISALLOW_COPY_AND_ASSIGN(BrowserPluginHostGuestDelegate);
113 };
114
115 } // namespace content
116
117 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_HOST_GUEST_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698