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

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: Address CL comments. Created 8 years, 3 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 and implements guest specific overrides for ViewHostMsg_*
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)).
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 acks so they are sent to browser plugin host (via
88 // embedder) instead of default view/widget host.
89 void HandleInputEventAck(RenderViewHost* render_view_host, bool handled);
90
91 void Destroy();
92
93 // WebContentsObserver implementation.
94 virtual void DidCommitProvisionalLoadForFrame(
95 int64 frame_id,
96 bool is_main_frame,
97 const GURL& url,
98 PageTransition transition_type,
99 RenderViewHost* render_view_host) OVERRIDE;
100 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
101
102 // WebContentsDelegate implementation.
103 virtual bool TakeFocus(bool reverse) OVERRIDE;
104 virtual void RendererUnresponsive(WebContents* source) OVERRIDE;
105
106 RenderProcessHost* embedder_render_process_host_;
107 // An identifier that uniquely identifies a browser plugin container within an
Charlie Reis 2012/08/29 00:11:04 What's a browser plugin container? Do you mean a
lazyboy 2012/08/29 21:24:44 Right, stale comments, fixed.
108 // embedder.
109 int instance_id_;
110 TransportDIB* damage_buffer_;
111 gfx::Size damage_buffer_size_;
112 float damage_buffer_scale_factor_;
113 scoped_ptr<IPC::Message> pending_input_event_reply_;
114 gfx::Rect guest_rect_;
115 WebCursor cursor_;
116 IDMap<RenderViewHost> pending_updates_;
117 int pending_update_counter_;
118
119 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
120 };
121
122 } // namespace content
123
124 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698