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

Side by Side Diff: components/guest_view/browser/guest_view_base.cc

Issue 2417693002: Allow MimeHandlerViewGuest be embedded inside OOPIFs (Closed)
Patch Set: Rebased Created 4 years, 1 month 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 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 <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "components/guest_view/browser/guest_view_event.h" 13 #include "components/guest_view/browser/guest_view_event.h"
14 #include "components/guest_view/browser/guest_view_manager.h" 14 #include "components/guest_view/browser/guest_view_manager.h"
15 #include "components/guest_view/common/guest_view_constants.h" 15 #include "components/guest_view/common/guest_view_constants.h"
16 #include "components/guest_view/common/guest_view_messages.h" 16 #include "components/guest_view/common/guest_view_messages.h"
17 #include "components/zoom/page_zoom.h" 17 #include "components/zoom/page_zoom.h"
18 #include "components/zoom/zoom_controller.h" 18 #include "components/zoom/zoom_controller.h"
19 #include "content/public/browser/navigation_details.h" 19 #include "content/public/browser/navigation_details.h"
20 #include "content/public/browser/render_frame_host.h" 20 #include "content/public/browser/render_frame_host.h"
21 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/render_widget_host.h"
23 #include "content/public/browser/render_widget_host_view.h" 24 #include "content/public/browser/render_widget_host_view.h"
24 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
25 #include "content/public/common/page_zoom.h" 26 #include "content/public/common/page_zoom.h"
26 #include "content/public/common/url_constants.h" 27 #include "content/public/common/url_constants.h"
27 #include "third_party/WebKit/public/web/WebInputEvent.h" 28 #include "third_party/WebKit/public/web/WebInputEvent.h"
28 29
29 using content::WebContents; 30 using content::WebContents;
30 31
31 namespace content { 32 namespace content {
32 struct FrameNavigateParams; 33 struct FrameNavigateParams;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 410
410 SetUpSizing(*attach_params()); 411 SetUpSizing(*attach_params());
411 412
412 // The guest should have the same muting state as the owner. 413 // The guest should have the same muting state as the owner.
413 web_contents()->SetAudioMuted(owner_web_contents()->IsAudioMuted()); 414 web_contents()->SetAudioMuted(owner_web_contents()->IsAudioMuted());
414 415
415 // Give the derived class an opportunity to perform some actions. 416 // Give the derived class an opportunity to perform some actions.
416 DidAttachToEmbedder(); 417 DidAttachToEmbedder();
417 418
418 // Inform the associated GuestViewContainer that the contentWindow is ready. 419 // Inform the associated GuestViewContainer that the contentWindow is ready.
419 embedder_web_contents()->Send(new GuestViewMsg_GuestAttached( 420 GetEmbedderFrame()->GetView()->GetRenderWidgetHost()->Send(
nasko 2016/10/27 21:03:40 Before this IPC was sent through the main frame. N
EhsanK 2016/10/27 22:06:48 As I understand, WebContentsImpl::Send will send i
nasko 2016/11/09 01:13:07 They all send through the same IPC channel. What m
EhsanK 2016/11/15 19:54:22 Acknowledged.
420 element_instance_id_, 421 new GuestViewMsg_GuestAttached(element_instance_id_,
421 guest_proxy_routing_id)); 422 guest_proxy_routing_id));
422 423
423 SendQueuedEvents(); 424 SendQueuedEvents();
424 } 425 }
425 426
426 void GuestViewBase::DidDetach() { 427 void GuestViewBase::DidDetach() {
427 GuestViewManager::FromBrowserContext(browser_context_)->DetachGuest(this); 428 GuestViewManager::FromBrowserContext(browser_context_)->DetachGuest(this);
428 StopTrackingEmbedderZoomLevel(); 429 StopTrackingEmbedderZoomLevel();
429 owner_web_contents()->Send(new GuestViewMsg_GuestDetached( 430 owner_web_contents()->Send(new GuestViewMsg_GuestDetached(
430 element_instance_id_)); 431 element_instance_id_));
431 element_instance_id_ = kInstanceIDNone; 432 element_instance_id_ = kInstanceIDNone;
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 887
887 void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size, 888 void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size,
888 bool due_to_auto_resize) { 889 bool due_to_auto_resize) {
889 if (due_to_auto_resize) 890 if (due_to_auto_resize)
890 GuestSizeChangedDueToAutoSize(guest_size_, new_size); 891 GuestSizeChangedDueToAutoSize(guest_size_, new_size);
891 DispatchOnResizeEvent(guest_size_, new_size); 892 DispatchOnResizeEvent(guest_size_, new_size);
892 guest_size_ = new_size; 893 guest_size_ = new_size;
893 } 894 }
894 895
895 } // namespace guest_view 896 } // namespace guest_view
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698