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