| 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/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/guest_view/browser/guest_view_event.h" | 10 #include "components/guest_view/browser/guest_view_event.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const content::LoadCommittedDetails& details, | 69 const content::LoadCommittedDetails& details, |
| 70 const content::FrameNavigateParams& params) override { | 70 const content::FrameNavigateParams& params) override { |
| 71 // If the embedder navigates to a different page then destroy the guest. | 71 // If the embedder navigates to a different page then destroy the guest. |
| 72 if (details.is_navigation_to_different_page()) | 72 if (details.is_navigation_to_different_page()) |
| 73 Destroy(); | 73 Destroy(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void RenderProcessGone(base::TerminationStatus status) override { | 76 void RenderProcessGone(base::TerminationStatus status) override { |
| 77 if (destroyed_) | 77 if (destroyed_) |
| 78 return; | 78 return; |
| 79 | |
| 80 GuestViewManager::FromBrowserContext(web_contents()->GetBrowserContext()) | |
| 81 ->EmbedderWillBeDestroyed( | |
| 82 web_contents()->GetRenderProcessHost()->GetID()); | |
| 83 | |
| 84 // If the embedder process is destroyed, then destroy the guest. | 79 // If the embedder process is destroyed, then destroy the guest. |
| 85 Destroy(); | 80 Destroy(); |
| 86 } | 81 } |
| 87 | 82 |
| 88 void DidToggleFullscreenModeForTab(bool entered_fullscreen) override { | 83 void DidToggleFullscreenModeForTab(bool entered_fullscreen) override { |
| 89 if (destroyed_) | 84 if (destroyed_) |
| 90 return; | 85 return; |
| 91 | 86 |
| 92 is_fullscreen_ = entered_fullscreen; | 87 is_fullscreen_ = entered_fullscreen; |
| 93 guest_->EmbedderFullscreenToggled(is_fullscreen_); | 88 guest_->EmbedderFullscreenToggled(is_fullscreen_); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 310 } |
| 316 | 311 |
| 317 DispatchOnResizeEvent(guest_size_, new_size); | 312 DispatchOnResizeEvent(guest_size_, new_size); |
| 318 guest_size_ = new_size; | 313 guest_size_ = new_size; |
| 319 } | 314 } |
| 320 | 315 |
| 321 auto_size_enabled_ = enable_auto_size; | 316 auto_size_enabled_ = enable_auto_size; |
| 322 } | 317 } |
| 323 | 318 |
| 324 // static | 319 // static |
| 325 void GuestViewBase::CleanUp(int embedder_process_id, int view_instance_id) { | 320 void GuestViewBase::CleanUp(content::BrowserContext* browser_context, |
| 321 int embedder_process_id, |
| 322 int view_instance_id) { |
| 326 // TODO(paulmeyer): Add in any general GuestView cleanup work here. | 323 // TODO(paulmeyer): Add in any general GuestView cleanup work here. |
| 327 } | 324 } |
| 328 | 325 |
| 329 // static | 326 // static |
| 330 GuestViewBase* GuestViewBase::FromWebContents(const WebContents* web_contents) { | 327 GuestViewBase* GuestViewBase::FromWebContents(const WebContents* web_contents) { |
| 331 WebContentsGuestViewMap* guest_map = webcontents_guestview_map.Pointer(); | 328 WebContentsGuestViewMap* guest_map = webcontents_guestview_map.Pointer(); |
| 332 auto it = guest_map->find(web_contents); | 329 auto it = guest_map->find(web_contents); |
| 333 return it == guest_map->end() ? nullptr : it->second; | 330 return it == guest_map->end() ? nullptr : it->second; |
| 334 } | 331 } |
| 335 | 332 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 | 826 |
| 830 auto embedder_zoom_controller = | 827 auto embedder_zoom_controller = |
| 831 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); | 828 ui_zoom::ZoomController::FromWebContents(owner_web_contents()); |
| 832 // Chrome Apps do not have a ZoomController. | 829 // Chrome Apps do not have a ZoomController. |
| 833 if (!embedder_zoom_controller) | 830 if (!embedder_zoom_controller) |
| 834 return; | 831 return; |
| 835 embedder_zoom_controller->RemoveObserver(this); | 832 embedder_zoom_controller->RemoveObserver(this); |
| 836 } | 833 } |
| 837 | 834 |
| 838 } // namespace guest_view | 835 } // namespace guest_view |
| OLD | NEW |