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

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: Updated comment 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); 319 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params);
321 320
322 // Forwards all messages from the |pending_messages_| queue to the embedder. 321 // Forwards all messages from the |pending_messages_| queue to the embedder.
323 void SendQueuedMessages(); 322 void SendQueuedMessages();
324 323
325 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; 324 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_;
326 WebContentsImpl* embedder_web_contents_; 325 WebContentsImpl* embedder_web_contents_;
327 326
328 // An identifier that uniquely identifies a browser plugin guest within an 327 // An identifier that uniquely identifies a browser plugin guest within an
329 // embedder. 328 // embedder.
330 const int instance_id_; 329 const int guest_instance_id_;
331 float guest_device_scale_factor_; 330 float guest_device_scale_factor_;
332 gfx::Rect guest_window_rect_; 331 gfx::Rect guest_window_rect_;
333 gfx::Rect guest_screen_rect_; 332 gfx::Rect guest_screen_rect_;
334 bool focused_; 333 bool focused_;
335 bool mouse_locked_; 334 bool mouse_locked_;
336 bool pending_lock_request_; 335 bool pending_lock_request_;
337 bool guest_visible_; 336 bool guest_visible_;
338 bool guest_opaque_; 337 bool guest_opaque_;
339 bool embedder_visible_; 338 bool embedder_visible_;
340 339
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Weak pointer used to ask GeolocationPermissionContext about geolocation 372 // Weak pointer used to ask GeolocationPermissionContext about geolocation
374 // permission. 373 // permission.
375 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; 374 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_;
376 375
377 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 376 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
378 }; 377 };
379 378
380 } // namespace content 379 } // namespace content
381 380
382 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 381 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698