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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 549 |
551 void GuestViewBase::DidNavigateMainFrame( | 550 void GuestViewBase::DidNavigateMainFrame( |
552 const content::LoadCommittedDetails& details, | 551 const content::LoadCommittedDetails& details, |
553 const content::FrameNavigateParams& params) { | 552 const content::FrameNavigateParams& params) { |
554 if (attached() && ZoomPropagatesFromEmbedderToGuest()) | 553 if (attached() && ZoomPropagatesFromEmbedderToGuest()) |
555 SetGuestZoomLevelToMatchEmbedder(); | 554 SetGuestZoomLevelToMatchEmbedder(); |
556 | 555 |
557 // TODO(lazyboy): This breaks guest visibility in --site-per-process because | 556 // TODO(lazyboy): This breaks guest visibility in --site-per-process because |
558 // we do not take the widget's visibility into account. We need to also | 557 // we do not take the widget's visibility into account. We need to also |
559 // stay hidden during "visibility:none" state. | 558 // stay hidden during "visibility:none" state. |
560 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 559 if (content::BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { |
561 switches::kSitePerProcess)) { | |
562 web_contents()->WasShown(); | 560 web_contents()->WasShown(); |
563 } | 561 } |
564 } | 562 } |
565 | 563 |
566 void GuestViewBase::ActivateContents(WebContents* web_contents) { | 564 void GuestViewBase::ActivateContents(WebContents* web_contents) { |
567 if (!attached() || !embedder_web_contents()->GetDelegate()) | 565 if (!attached() || !embedder_web_contents()->GetDelegate()) |
568 return; | 566 return; |
569 | 567 |
570 embedder_web_contents()->GetDelegate()->ActivateContents( | 568 embedder_web_contents()->GetDelegate()->ActivateContents( |
571 embedder_web_contents()); | 569 embedder_web_contents()); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 | 824 |
827 auto embedder_zoom_controller = | 825 auto embedder_zoom_controller = |
828 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); | 826 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); |
829 // Chrome Apps do not have a ZoomController. | 827 // Chrome Apps do not have a ZoomController. |
830 if (!embedder_zoom_controller) | 828 if (!embedder_zoom_controller) |
831 return; | 829 return; |
832 embedder_zoom_controller->RemoveObserver(this); | 830 embedder_zoom_controller->RemoveObserver(this); |
833 } | 831 } |
834 | 832 |
835 } // namespace guest_view | 833 } // namespace guest_view |
OLD | NEW |