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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.h

Issue 10868012: Browser Plugin: New Implementation (Browser Side) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master-trial-obrowser
Patch Set: Rename class as we agreed upon, keep correct type of instances (guest/embedder, not helpers) inside… 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_GUEST_H_
6 #define CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_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 BrowserPluginEmbedder;
34 class RenderProcessHost;
35
36 // A browser plugin guest provides functionality for WebContents to operate in
37 // the guest role, implements guest specific overrides for ViewHostMsg_*
Charlie Reis 2012/08/27 20:23:59 nit: the guest role and implements
lazyboy 2012/08/28 19:07:14 Done.
38 // messages.
39 class BrowserPluginGuest : public WebContentsDelegate,
40 public WebContentsObserver {
41 public:
42 BrowserPluginGuest(int instance_id,
43 WebContentsImpl* web_contents,
44 RenderViewHost* render_view_host);
45 virtual ~BrowserPluginGuest();
46
47 private:
48 friend class BrowserPluginEmbedder;
49 friend class BrowserPluginGuestHelper;
50
51 void set_embedder_render_process_host(
52 RenderProcessHost* render_process_host) {
53 embedder_render_process_host_ = render_process_host;
54 }
55 RenderProcessHost* embedder_render_process_host() {
56 return embedder_render_process_host_;
57 }
58 // Returns the identifier that uniquely identifies a browser plugin guest
59 // within an embedder.
60 int instance_id() const { return instance_id_; }
61
62 void SetDamageBuffer(TransportDIB* damage_buffer,
63 const gfx::Size& size,
64 float scale_factor);
65 TransportDIB* damage_buffer() const { return damage_buffer_; }
66 const gfx::Size& damage_buffer_size() const { return damage_buffer_size_; }
67 float damage_buffer_scale_factor() const {
68 return damage_buffer_scale_factor_;
69 }
70
71 void UpdateRect(RenderViewHost* render_view_host,
72 const ViewHostMsg_UpdateRect_Params& params);
73 void UpdateRectACK(int message_id, const gfx::Size& size);
74 // Handles input event routed through the embedder (which is initiated in the
75 // browser plugin {renderer side of the embedder}).
Charlie Reis 2012/08/27 20:23:59 nit: Just used nested parens.
lazyboy 2012/08/28 19:07:14 Done.
76 void HandleInputEvent(RenderViewHost* render_view_host,
77 const gfx::Rect& guest_rect,
78 const WebKit::WebInputEvent& event,
79 IPC::Message* reply_message);
80 // Overrides default ShowWidget message so we show them on the correct
81 // coordinates.
82 void ShowWidget(RenderViewHost* render_view_host,
83 int route_id,
84 const gfx::Rect& initial_pos);
85 void SetFocus(bool focused);
86 void SetCursor(const WebCursor& cursor);
87 // Handles input event ack so it's sent to browser plugin host (via embedder)
Charlie Reis 2012/08/27 20:23:59 nit: acks so they're sent
lazyboy 2012/08/28 19:07:14 Done.
88 // instead of default view/widget host.
89 void HandleInputEventAck(RenderViewHost* render_view_host, bool handled);
90
91 void Destroy();
92
93 // WebContentsObserver implementation.
94 // Used to monitor frame navigation to cleanup itself up.
Charlie Reis 2012/08/27 20:23:59 nit: clean (Why does the guest need cleaning up h
lazyboy 2012/08/28 19:07:14 Right, cleanup is done on embedder's version of Di
95 virtual void DidCommitProvisionalLoadForFrame(
96 int64 frame_id,
97 bool is_main_frame,
98 const GURL& url,
99 PageTransition transition_type,
100 RenderViewHost* render_view_host) OVERRIDE;
101 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
102
103 // WebContentsDelegate implementation.
104 virtual bool TakeFocus(bool reverse) OVERRIDE;
105 virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
106
107 RenderProcessHost* embedder_render_process_host_;
108 // An identifier that uniquely identifies a browser plugin container within an
109 // embedder.
110 int instance_id_;
111 TransportDIB* damage_buffer_;
112 gfx::Size damage_buffer_size_;
113 float damage_buffer_scale_factor_;
114 scoped_ptr<IPC::Message> pending_input_event_reply_;
115 gfx::Rect guest_rect_;
116 WebCursor cursor_;
117 IDMap<RenderViewHost> pending_updates_;
118 int pending_update_counter_;
119
120 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
121 };
122
123 } // namespace content
124
125 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698