| 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/command_line.h" | |
| 8 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/guest_view/browser/guest_view_event.h" | 9 #include "components/guest_view/browser/guest_view_event.h" |
| 11 #include "components/guest_view/browser/guest_view_manager.h" | 10 #include "components/guest_view/browser/guest_view_manager.h" |
| 12 #include "components/guest_view/common/guest_view_constants.h" | 11 #include "components/guest_view/common/guest_view_constants.h" |
| 13 #include "components/guest_view/common/guest_view_messages.h" | 12 #include "components/guest_view/common/guest_view_messages.h" |
| 14 #include "components/ui/zoom/page_zoom.h" | 13 #include "components/ui/zoom/page_zoom.h" |
| 15 #include "components/ui/zoom/zoom_controller.h" | 14 #include "components/ui/zoom/zoom_controller.h" |
| 16 #include "content/public/browser/navigation_details.h" | 15 #include "content/public/browser/navigation_details.h" |
| 17 #include "content/public/browser/render_frame_host.h" | 16 #include "content/public/browser/render_frame_host.h" |
| 18 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 19 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 20 #include "content/public/browser/render_widget_host_view.h" | 19 #include "content/public/browser/render_widget_host_view.h" |
| 21 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 22 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/browser_plugin_guest_mode.h" |
| 23 #include "content/public/common/page_zoom.h" | 22 #include "content/public/common/page_zoom.h" |
| 24 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
| 25 #include "third_party/WebKit/public/web/WebInputEvent.h" | 24 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 26 | 25 |
| 27 using content::WebContents; | 26 using content::WebContents; |
| 28 | 27 |
| 29 namespace content { | 28 namespace content { |
| 30 struct FrameNavigateParams; | 29 struct FrameNavigateParams; |
| 31 } | 30 } |
| 32 | 31 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 552 |
| 554 void GuestViewBase::DidNavigateMainFrame( | 553 void GuestViewBase::DidNavigateMainFrame( |
| 555 const content::LoadCommittedDetails& details, | 554 const content::LoadCommittedDetails& details, |
| 556 const content::FrameNavigateParams& params) { | 555 const content::FrameNavigateParams& params) { |
| 557 if (attached() && ZoomPropagatesFromEmbedderToGuest()) | 556 if (attached() && ZoomPropagatesFromEmbedderToGuest()) |
| 558 SetGuestZoomLevelToMatchEmbedder(); | 557 SetGuestZoomLevelToMatchEmbedder(); |
| 559 | 558 |
| 560 // TODO(lazyboy): This breaks guest visibility in --site-per-process because | 559 // TODO(lazyboy): This breaks guest visibility in --site-per-process because |
| 561 // we do not take the widget's visibility into account. We need to also | 560 // we do not take the widget's visibility into account. We need to also |
| 562 // stay hidden during "visibility:none" state. | 561 // stay hidden during "visibility:none" state. |
| 563 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 562 if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
| 564 switches::kSitePerProcess)) { | |
| 565 web_contents()->WasShown(); | 563 web_contents()->WasShown(); |
| 566 } | 564 } |
| 567 } | 565 } |
| 568 | 566 |
| 569 void GuestViewBase::ActivateContents(WebContents* web_contents) { | 567 void GuestViewBase::ActivateContents(WebContents* web_contents) { |
| 570 if (!attached() || !embedder_web_contents()->GetDelegate()) | 568 if (!attached() || !embedder_web_contents()->GetDelegate()) |
| 571 return; | 569 return; |
| 572 | 570 |
| 573 embedder_web_contents()->GetDelegate()->ActivateContents( | 571 embedder_web_contents()->GetDelegate()->ActivateContents( |
| 574 embedder_web_contents()); | 572 embedder_web_contents()); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 | 827 |
| 830 auto embedder_zoom_controller = | 828 auto embedder_zoom_controller = |
| 831 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); | 829 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); |
| 832 // Chrome Apps do not have a ZoomController. | 830 // Chrome Apps do not have a ZoomController. |
| 833 if (!embedder_zoom_controller) | 831 if (!embedder_zoom_controller) |
| 834 return; | 832 return; |
| 835 embedder_zoom_controller->RemoveObserver(this); | 833 embedder_zoom_controller->RemoveObserver(this); |
| 836 } | 834 } |
| 837 | 835 |
| 838 } // namespace guest_view | 836 } // namespace guest_view |
| OLD | NEW |