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 "components/guest_view/browser/guest_view_base.h" | 5 #include "components/guest_view/browser/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/guest_view/browser/guest_view_event.h" | 9 #include "components/guest_view/browser/guest_view_event.h" |
10 #include "components/guest_view/browser/guest_view_manager.h" | 10 #include "components/guest_view/browser/guest_view_manager.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 WebContentsObserver::Observe(guest_web_contents); | 210 WebContentsObserver::Observe(guest_web_contents); |
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(kParameterInstanceId, &view_instance_id_); | 218 create_params.GetInteger(kParameterInstanceId, &view_instance_id_); |
219 | 219 |
220 if (CanRunInDetachedState()) | 220 // if (CanRunInDetachedState()) |
221 SetUpSizing(create_params); | 221 // SetUpSizing(create_params); |
222 | 222 |
223 // Observe guest zoom changes. | 223 // Observe guest zoom changes. |
224 auto zoom_controller = | 224 auto zoom_controller = |
225 ui_zoom::ZoomController::FromWebContents(web_contents()); | 225 ui_zoom::ZoomController::FromWebContents(web_contents()); |
226 zoom_controller->AddObserver(this); | 226 zoom_controller->AddObserver(this); |
227 | 227 |
228 // Give the derived class an opportunity to perform additional initialization. | 228 // Give the derived class an opportunity to perform additional initialization. |
229 DidInitialize(create_params); | 229 DidInitialize(create_params); |
230 } | 230 } |
231 | 231 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 content::WebContents* GuestViewBase::CreateNewGuestWindow( | 372 content::WebContents* GuestViewBase::CreateNewGuestWindow( |
373 const content::WebContents::CreateParams& create_params) { | 373 const content::WebContents::CreateParams& create_params) { |
374 auto guest_manager = GuestViewManager::FromBrowserContext(browser_context()); | 374 auto guest_manager = GuestViewManager::FromBrowserContext(browser_context()); |
375 return guest_manager->CreateGuestWithWebContentsParams( | 375 return guest_manager->CreateGuestWithWebContentsParams( |
376 GetViewType(), | 376 GetViewType(), |
377 owner_web_contents(), | 377 owner_web_contents(), |
378 create_params); | 378 create_params); |
379 } | 379 } |
380 | 380 |
381 void GuestViewBase::DidAttach(int guest_proxy_routing_id) { | 381 void GuestViewBase::DidAttach(int guest_proxy_routing_id) { |
382 DCHECK(guest_proxy_routing_id_ == MSG_ROUTING_NONE || | 382 // DCHECK(guest_proxy_routing_id_ == MSG_ROUTING_NONE || |
383 guest_proxy_routing_id == guest_proxy_routing_id_); | 383 // guest_proxy_routing_id == guest_proxy_routing_id_); |
384 guest_proxy_routing_id_ = guest_proxy_routing_id; | 384 guest_proxy_routing_id_ = guest_proxy_routing_id; |
385 | 385 |
386 opener_lifetime_observer_.reset(); | 386 opener_lifetime_observer_.reset(); |
387 | 387 |
388 SetUpSizing(*attach_params()); | 388 SetUpSizing(*attach_params()); |
389 | 389 |
390 // Give the derived class an opportunity to perform some actions. | 390 // Give the derived class an opportunity to perform some actions. |
391 DidAttachToEmbedder(); | 391 DidAttachToEmbedder(); |
392 | 392 |
393 // Inform the associated GuestViewContainer that the contentWindow is ready. | 393 // Inform the associated GuestViewContainer that the contentWindow is ready. |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 | 823 |
824 auto embedder_zoom_controller = | 824 auto embedder_zoom_controller = |
825 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); | 825 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); |
826 // Chrome Apps do not have a ZoomController. | 826 // Chrome Apps do not have a ZoomController. |
827 if (!embedder_zoom_controller) | 827 if (!embedder_zoom_controller) |
828 return; | 828 return; |
829 embedder_zoom_controller->RemoveObserver(this); | 829 embedder_zoom_controller->RemoveObserver(this); |
830 } | 830 } |
831 | 831 |
832 } // namespace guest_view | 832 } // namespace guest_view |
OLD | NEW |