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

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

Issue 444813002: Remove BrowserPlugin's -internal-attach method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A BrowserPluginGuest is the browser side of a browser <--> embedder 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder
6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder
7 // renderer side of browser <--> embedder renderer communication. 7 // renderer side of browser <--> embedder renderer communication.
8 // 8 //
9 // BrowserPluginGuest lives on the UI thread of the browser process. Any 9 // BrowserPluginGuest lives on the UI thread of the browser process. Any
10 // messages about the guest render process that the embedder might be interested 10 // messages about the guest render process that the embedder might be interested
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // this BrowserPluginGuest, and its new unattached windows. 112 // this BrowserPluginGuest, and its new unattached windows.
113 void Destroy(); 113 void Destroy();
114 114
115 // Creates a new guest WebContentsImpl with the provided |params| with |this| 115 // Creates a new guest WebContentsImpl with the provided |params| with |this|
116 // as the |opener|. 116 // as the |opener|.
117 WebContentsImpl* CreateNewGuestWindow( 117 WebContentsImpl* CreateNewGuestWindow(
118 const WebContents::CreateParams& params); 118 const WebContents::CreateParams& params);
119 119
120 // Returns the identifier that uniquely identifies a browser plugin guest 120 // Returns the identifier that uniquely identifies a browser plugin guest
121 // within an embedder. 121 // within an embedder.
122 int instance_id() const { return instance_id_; } 122 // TODO(lazyboy): Rename this to guest_instance_id().
123 int instance_id() const { return guest_instance_id_; }
123 124
124 bool OnMessageReceivedFromEmbedder(const IPC::Message& message); 125 bool OnMessageReceivedFromEmbedder(const IPC::Message& message);
125 126
126 WebContentsImpl* embedder_web_contents() const { 127 WebContentsImpl* embedder_web_contents() const {
127 return embedder_web_contents_; 128 return embedder_web_contents_;
128 } 129 }
129 130
130 // Returns the embedder's RenderWidgetHostView if it is available. 131 // Returns the embedder's RenderWidgetHostView if it is available.
131 // Returns NULL otherwise. 132 // Returns NULL otherwise.
132 RenderWidgetHostView* GetEmbedderRenderWidgetHostView(); 133 RenderWidgetHostView* GetEmbedderRenderWidgetHostView();
(...skipping 29 matching lines...) Expand all
162 // Helper to send messages to embedder. This methods fills the message with 163 // Helper to send messages to embedder. This methods fills the message with
163 // the correct routing id. 164 // the correct routing id.
164 void SendMessageToEmbedder(IPC::Message* msg); 165 void SendMessageToEmbedder(IPC::Message* msg);
165 166
166 // Returns whether the guest is attached to an embedder. 167 // Returns whether the guest is attached to an embedder.
167 bool attached() const { return embedder_web_contents_ != NULL; } 168 bool attached() const { return embedder_web_contents_ != NULL; }
168 169
169 // Attaches this BrowserPluginGuest to the provided |embedder_web_contents| 170 // Attaches this BrowserPluginGuest to the provided |embedder_web_contents|
170 // and initializes the guest with the provided |params|. Attaching a guest 171 // and initializes the guest with the provided |params|. Attaching a guest
171 // to an embedder implies that this guest's lifetime is no longer managed 172 // to an embedder implies that this guest's lifetime is no longer managed
172 // by its opener, and it can begin loading resources. |extra_params| are 173 // by its opener, and it can begin loading resources.
173 // parameters passed into BrowserPlugin from JavaScript to be forwarded to 174 void Attach(int browser_plugin_instance_id,
174 // the content embedder. 175 WebContentsImpl* embedder_web_contents,
175 void Attach(WebContentsImpl* embedder_web_contents, 176 const BrowserPluginHostMsg_Attach_Params& params);
176 const BrowserPluginHostMsg_Attach_Params& params,
177 const base::DictionaryValue& extra_params);
178 177
179 // Returns whether BrowserPluginGuest is interested in receiving the given 178 // Returns whether BrowserPluginGuest is interested in receiving the given
180 // |message|. 179 // |message|.
181 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message); 180 static bool ShouldForwardToBrowserPluginGuest(const IPC::Message& message);
182 gfx::Rect ToGuestRect(const gfx::Rect& rect); 181 gfx::Rect ToGuestRect(const gfx::Rect& rect);
183 182
184 void DragSourceEndedAt(int client_x, int client_y, int screen_x, 183 void DragSourceEndedAt(int client_x, int client_y, int screen_x,
185 int screen_y, blink::WebDragOperation operation); 184 int screen_y, blink::WebDragOperation operation);
186 185
187 // Called when the drag started by this guest ends at an OS-level. 186 // Called when the drag started by this guest ends at an OS-level.
(...skipping 10 matching lines...) Expand all
198 197
199 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and 198 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and
200 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. 199 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest.
201 BrowserPluginGuest(int instance_id, 200 BrowserPluginGuest(int instance_id,
202 bool has_render_view, 201 bool has_render_view,
203 WebContentsImpl* web_contents, 202 WebContentsImpl* web_contents,
204 BrowserPluginGuestDelegate* delegate); 203 BrowserPluginGuestDelegate* delegate);
205 204
206 void WillDestroy(); 205 void WillDestroy();
207 206
208 void Initialize(const BrowserPluginHostMsg_Attach_Params& params, 207 void Initialize(int browser_plugin_instance_id,
209 WebContentsImpl* embedder_web_contents, 208 const BrowserPluginHostMsg_Attach_Params& params,
210 const base::DictionaryValue& extra_params); 209 WebContentsImpl* embedder_web_contents);
211 210
212 bool InAutoSizeBounds(const gfx::Size& size) const; 211 bool InAutoSizeBounds(const gfx::Size& size) const;
213 212
214 // Message handlers for messages from embedder. 213 // Message handlers for messages from embedder.
215 214
216 void OnCompositorFrameSwappedACK( 215 void OnCompositorFrameSwappedACK(
217 int instance_id, 216 int instance_id,
218 const FrameHostMsg_CompositorFrameSwappedACK_Params& params); 217 const FrameHostMsg_CompositorFrameSwappedACK_Params& params);
219 void OnCopyFromCompositingSurfaceAck(int instance_id, 218 void OnCopyFromCompositingSurfaceAck(int instance_id,
220 int request_id, 219 int request_id,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); 323 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params);
325 324
326 // Forwards all messages from the |pending_messages_| queue to the embedder. 325 // Forwards all messages from the |pending_messages_| queue to the embedder.
327 void SendQueuedMessages(); 326 void SendQueuedMessages();
328 327
329 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; 328 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_;
330 WebContentsImpl* embedder_web_contents_; 329 WebContentsImpl* embedder_web_contents_;
331 330
332 // An identifier that uniquely identifies a browser plugin guest within an 331 // An identifier that uniquely identifies a browser plugin guest within an
333 // embedder. 332 // embedder.
334 const int instance_id_; 333 const int guest_instance_id_;
335 float guest_device_scale_factor_; 334 float guest_device_scale_factor_;
336 gfx::Rect guest_window_rect_; 335 gfx::Rect guest_window_rect_;
337 gfx::Rect guest_screen_rect_; 336 gfx::Rect guest_screen_rect_;
338 bool focused_; 337 bool focused_;
339 bool mouse_locked_; 338 bool mouse_locked_;
340 bool pending_lock_request_; 339 bool pending_lock_request_;
341 bool guest_visible_; 340 bool guest_visible_;
342 bool guest_opaque_; 341 bool guest_opaque_;
343 bool embedder_visible_; 342 bool embedder_visible_;
344 std::string name_; 343 std::string name_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // Weak pointer used to ask GeolocationPermissionContext about geolocation 381 // Weak pointer used to ask GeolocationPermissionContext about geolocation
383 // permission. 382 // permission.
384 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; 383 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_;
385 384
386 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 385 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
387 }; 386 };
388 387
389 } // namespace content 388 } // namespace content
390 389
391 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 390 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_embedder.cc ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698