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

Unified Diff: extensions/browser/guest_view/guest_view_base.cc

Issue 910073003: <webview>: Make contentWindow available prior to attachment (on display:none). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed creis' comments Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/guest_view/guest_view_base.cc
diff --git a/extensions/browser/guest_view/guest_view_base.cc b/extensions/browser/guest_view/guest_view_base.cc
index 7e5568711db5d64b17226cc211db8ede3f94a465..ed8187cc5f6d8718cdbcc2df5e350b384d92c94b 100644
--- a/extensions/browser/guest_view/guest_view_base.cc
+++ b/extensions/browser/guest_view/guest_view_base.cc
@@ -153,7 +153,7 @@ GuestViewBase::GuestViewBase(content::WebContents* owner_web_contents)
element_instance_id_(guestview::kInstanceIDNone),
initialized_(false),
is_being_destroyed_(false),
- guest_sizer_(nullptr),
+ guest_proxy_host_(nullptr),
Charlie Reis 2015/03/09 21:25:22 You need to initialize guest_proxy_routing_id_ to
Fady Samuel 2015/03/09 23:02:42 Done.
auto_size_enabled_(false),
is_full_page_plugin_(false),
weak_ptr_factory_(this) {
@@ -232,6 +232,11 @@ void GuestViewBase::InitWithWebContents(
DidInitialize(create_params);
}
+void GuestViewBase::LoadURLWithParams(
Charlie Reis 2015/03/09 21:25:22 Can this get called multiple times? We don't want
Fady Samuel 2015/03/09 23:02:41 Done.
+ const content::NavigationController::LoadURLParams& load_params) {
+ guest_proxy_routing_id_ = proxy_host()->LoadURLWithParams(load_params);
Charlie Reis 2015/03/09 18:52:59 If we can get the routing ID from the GuestProxyHo
Charlie Reis 2015/03/09 21:25:22 Disregard. Only makes sense in Option 2.
Fady Samuel 2015/03/09 23:02:41 Done.
Fady Samuel 2015/03/09 23:02:41 Done.
+}
+
void GuestViewBase::DispatchOnResizeEvent(const gfx::Size& old_size,
const gfx::Size& new_size) {
if (new_size == old_size)
@@ -291,7 +296,7 @@ void GuestViewBase::SetSize(const SetSizeParams& params) {
GuestSizeChangedDueToAutoSize(guest_size_, new_size);
} else {
// Autosize was already disabled.
- guest_sizer_->SizeContents(new_size);
+ guest_proxy_host_->SizeContents(new_size);
}
DispatchOnResizeEvent(guest_size_, new_size);
@@ -379,6 +384,8 @@ content::WebContents* GuestViewBase::CreateNewGuestWindow(
}
void GuestViewBase::DidAttach(int guest_proxy_routing_id) {
+ guest_proxy_routing_id_ = guest_proxy_routing_id;
Charlie Reis 2015/03/09 21:25:22 Similar DCHECK to make sure it doesn't change afte
Fady Samuel 2015/03/09 23:02:42 Done.
+
opener_lifetime_observer_.reset();
SetUpSizing(*attach_params());
@@ -424,8 +431,6 @@ void GuestViewBase::Destroy() {
is_being_destroyed_ = true;
- guest_sizer_ = nullptr;
-
// It is important to clear owner_web_contents_ after the call to
// StopTrackingEmbedderZoomLevel(), but before the rest of
// the statements in this function.
@@ -443,8 +448,8 @@ void GuestViewBase::Destroy() {
weak_ptr_factory_.InvalidateWeakPtrs();
// Give the content module an opportunity to perform some cleanup.
- if (!destruction_callback_.is_null())
- destruction_callback_.Run();
+ guest_proxy_host_->WillDestroy();
+ guest_proxy_host_ = nullptr;
webcontents_guestview_map.Get().erase(web_contents());
GuestViewManager::FromBrowserContext(browser_context_)->
@@ -471,13 +476,9 @@ void GuestViewBase::SetOpener(GuestViewBase* guest) {
opener_lifetime_observer_.reset();
}
-void GuestViewBase::RegisterDestructionCallback(
- const DestructionCallback& callback) {
- destruction_callback_ = callback;
-}
-
-void GuestViewBase::SetGuestSizer(content::GuestSizer* guest_sizer) {
- guest_sizer_ = guest_sizer;
+void GuestViewBase::SetGuestProxyHost(
+ content::GuestProxyHost* guest_proxy_host) {
+ guest_proxy_host_ = guest_proxy_host;
}
void GuestViewBase::WillAttach(content::WebContents* embedder_web_contents,

Powered by Google App Engine
This is Rietveld 408576698