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

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

Issue 1199963011: Force new surface on BrowserPluginGuest reattach. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test, and add check for null surface id in test. Created 5 years, 5 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
« no previous file with comments | « no previous file | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const; 184 gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const;
185 185
186 // Helper to send messages to embedder. If this guest is not yet attached, 186 // Helper to send messages to embedder. If this guest is not yet attached,
187 // then IPCs will be queued until attachment. 187 // then IPCs will be queued until attachment.
188 void SendMessageToEmbedder(IPC::Message* msg); 188 void SendMessageToEmbedder(IPC::Message* msg);
189 189
190 // Returns whether the guest is attached to an embedder. 190 // Returns whether the guest is attached to an embedder.
191 bool attached() const { return attached_; } 191 bool attached() const { return attached_; }
192 192
193 // Returns true when an attachment has taken place since the last time the
194 // compositor surface was set.
195 bool has_attached_since_surface_set() const {
196 return has_attached_since_surface_set_;
197 }
198
193 // Attaches this BrowserPluginGuest to the provided |embedder_web_contents| 199 // Attaches this BrowserPluginGuest to the provided |embedder_web_contents|
194 // and initializes the guest with the provided |params|. Attaching a guest 200 // and initializes the guest with the provided |params|. Attaching a guest
195 // to an embedder implies that this guest's lifetime is no longer managed 201 // to an embedder implies that this guest's lifetime is no longer managed
196 // by its opener, and it can begin loading resources. 202 // by its opener, and it can begin loading resources.
197 void Attach(int browser_plugin_instance_id, 203 void Attach(int browser_plugin_instance_id,
198 WebContentsImpl* embedder_web_contents, 204 WebContentsImpl* embedder_web_contents,
199 const BrowserPluginHostMsg_Attach_Params& params); 205 const BrowserPluginHostMsg_Attach_Params& params);
200 206
201 // Returns whether BrowserPluginGuest is interested in receiving the given 207 // Returns whether BrowserPluginGuest is interested in receiving the given
202 // |message|. 208 // |message|.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 244
239 protected: 245 protected:
240 246
241 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and 247 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and
242 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. 248 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest.
243 // Constructor protected for testing. 249 // Constructor protected for testing.
244 BrowserPluginGuest(bool has_render_view, 250 BrowserPluginGuest(bool has_render_view,
245 WebContentsImpl* web_contents, 251 WebContentsImpl* web_contents,
246 BrowserPluginGuestDelegate* delegate); 252 BrowserPluginGuestDelegate* delegate);
247 253
254 // Protected for testing.
255 void set_has_attached_since_surface_set_for_test(bool has_attached) {
256 has_attached_since_surface_set_ = has_attached;
257 }
258
259 void set_attached_for_test(bool attached) {
260 attached_ = attached;
261 }
262
248 private: 263 private:
249 class EmbedderVisibilityObserver; 264 class EmbedderVisibilityObserver;
250 265
251 void InitInternal(const BrowserPluginHostMsg_Attach_Params& params, 266 void InitInternal(const BrowserPluginHostMsg_Attach_Params& params,
252 WebContentsImpl* owner_web_contents); 267 WebContentsImpl* owner_web_contents);
253 268
254 bool InAutoSizeBounds(const gfx::Size& size) const; 269 bool InAutoSizeBounds(const gfx::Size& size) const;
255 270
256 void OnSatisfySequence(int instance_id, const cc::SurfaceSequence& sequence); 271 void OnSatisfySequence(int instance_id, const cc::SurfaceSequence& sequence);
257 void OnRequireSequence(int instance_id, 272 void OnRequireSequence(int instance_id,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 381
367 // The last tooltip that was set with SetTooltipText(). 382 // The last tooltip that was set with SetTooltipText().
368 base::string16 current_tooltip_text_; 383 base::string16 current_tooltip_text_;
369 384
370 scoped_ptr<EmbedderVisibilityObserver> embedder_visibility_observer_; 385 scoped_ptr<EmbedderVisibilityObserver> embedder_visibility_observer_;
371 WebContentsImpl* owner_web_contents_; 386 WebContentsImpl* owner_web_contents_;
372 387
373 // Indicates whether this guest has been attached to a container. 388 // Indicates whether this guest has been attached to a container.
374 bool attached_; 389 bool attached_;
375 390
391 // Used to signal if a browser plugin has been attached since the last time
392 // the compositing surface was set.
393 bool has_attached_since_surface_set_;
394
376 // An identifier that uniquely identifies a browser plugin within an embedder. 395 // An identifier that uniquely identifies a browser plugin within an embedder.
377 int browser_plugin_instance_id_; 396 int browser_plugin_instance_id_;
378 gfx::Rect guest_window_rect_; 397 gfx::Rect guest_window_rect_;
379 bool focused_; 398 bool focused_;
380 bool mouse_locked_; 399 bool mouse_locked_;
381 bool pending_lock_request_; 400 bool pending_lock_request_;
382 bool guest_visible_; 401 bool guest_visible_;
383 bool embedder_visible_; 402 bool embedder_visible_;
384 // Whether the browser plugin is inside a plugin document. 403 // Whether the browser plugin is inside a plugin document.
385 bool is_full_page_plugin_; 404 bool is_full_page_plugin_;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 // Weak pointer used to ask GeolocationPermissionContext about geolocation 456 // Weak pointer used to ask GeolocationPermissionContext about geolocation
438 // permission. 457 // permission.
439 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; 458 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_;
440 459
441 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 460 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
442 }; 461 };
443 462
444 } // namespace content 463 } // namespace content
445 464
446 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 465 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698