OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "extensions/browser/guest_view/guest_view_base.h" | 5 #include "extensions/browser/guest_view/guest_view_base.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/ui/zoom/page_zoom.h" | 9 #include "components/ui/zoom/page_zoom.h" |
10 #include "components/ui/zoom/zoom_controller.h" | 10 #include "components/ui/zoom/zoom_controller.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 guest_web_contents->SetDelegate(this); | 211 guest_web_contents->SetDelegate(this); |
212 webcontents_guestview_map.Get().insert( | 212 webcontents_guestview_map.Get().insert( |
213 std::make_pair(guest_web_contents, this)); | 213 std::make_pair(guest_web_contents, this)); |
214 GuestViewManager::FromBrowserContext(browser_context_)-> | 214 GuestViewManager::FromBrowserContext(browser_context_)-> |
215 AddGuest(guest_instance_id_, guest_web_contents); | 215 AddGuest(guest_instance_id_, guest_web_contents); |
216 | 216 |
217 // Populate the view instance ID if we have it on creation. | 217 // Populate the view instance ID if we have it on creation. |
218 create_params.GetInteger(guestview::kParameterInstanceId, | 218 create_params.GetInteger(guestview::kParameterInstanceId, |
219 &view_instance_id_); | 219 &view_instance_id_); |
220 | 220 |
221 if (CanRunInDetachedState()) | 221 // if (CanRunInDetachedState()) |
222 SetUpSizing(create_params); | 222 // SetUpSizing(create_params); |
223 | 223 |
224 // Observe guest zoom changes. | 224 // Observe guest zoom changes. |
225 auto zoom_controller = | 225 auto zoom_controller = |
226 ui_zoom::ZoomController::FromWebContents(web_contents()); | 226 ui_zoom::ZoomController::FromWebContents(web_contents()); |
227 zoom_controller->AddObserver(this); | 227 zoom_controller->AddObserver(this); |
228 | 228 |
229 // Give the derived class an opportunity to perform additional initialization. | 229 // Give the derived class an opportunity to perform additional initialization. |
230 DidInitialize(create_params); | 230 DidInitialize(create_params); |
231 } | 231 } |
232 | 232 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 content::WebContents* GuestViewBase::CreateNewGuestWindow( | 374 content::WebContents* GuestViewBase::CreateNewGuestWindow( |
375 const content::WebContents::CreateParams& create_params) { | 375 const content::WebContents::CreateParams& create_params) { |
376 auto guest_manager = GuestViewManager::FromBrowserContext(browser_context()); | 376 auto guest_manager = GuestViewManager::FromBrowserContext(browser_context()); |
377 return guest_manager->CreateGuestWithWebContentsParams( | 377 return guest_manager->CreateGuestWithWebContentsParams( |
378 GetViewType(), | 378 GetViewType(), |
379 owner_web_contents(), | 379 owner_web_contents(), |
380 create_params); | 380 create_params); |
381 } | 381 } |
382 | 382 |
383 void GuestViewBase::DidAttach(int guest_proxy_routing_id) { | 383 void GuestViewBase::DidAttach(int guest_proxy_routing_id) { |
384 DCHECK(guest_proxy_routing_id_ == MSG_ROUTING_NONE || | 384 // DCHECK(guest_proxy_routing_id_ == MSG_ROUTING_NONE || |
385 guest_proxy_routing_id == guest_proxy_routing_id_); | 385 // guest_proxy_routing_id == guest_proxy_routing_id_); |
386 guest_proxy_routing_id_ = guest_proxy_routing_id; | 386 guest_proxy_routing_id_ = guest_proxy_routing_id; |
387 | 387 |
388 opener_lifetime_observer_.reset(); | 388 opener_lifetime_observer_.reset(); |
389 | 389 |
390 SetUpSizing(*attach_params()); | 390 SetUpSizing(*attach_params()); |
391 | 391 |
392 // Give the derived class an opportunity to perform some actions. | 392 // Give the derived class an opportunity to perform some actions. |
393 DidAttachToEmbedder(); | 393 DidAttachToEmbedder(); |
394 | 394 |
395 // Inform the associated GuestViewContainer that the contentWindow is ready. | 395 // Inform the associated GuestViewContainer that the contentWindow is ready. |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 | 815 |
816 auto embedder_zoom_controller = | 816 auto embedder_zoom_controller = |
817 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); | 817 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); |
818 // Chrome Apps do not have a ZoomController. | 818 // Chrome Apps do not have a ZoomController. |
819 if (!embedder_zoom_controller) | 819 if (!embedder_zoom_controller) |
820 return; | 820 return; |
821 embedder_zoom_controller->RemoveObserver(this); | 821 embedder_zoom_controller->RemoveObserver(this); |
822 } | 822 } |
823 | 823 |
824 } // namespace extensions | 824 } // namespace extensions |
OLD | NEW |