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

Unified Diff: components/guest_view/browser/guest_view_base.cc

Issue 2666363002: Convert GuestViewBase to use the new navigation callbacks. (Closed)
Patch Set: Created 3 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/guest_view/browser/guest_view_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/guest_view/browser/guest_view_base.cc
diff --git a/components/guest_view/browser/guest_view_base.cc b/components/guest_view/browser/guest_view_base.cc
index 98a25805dc97d27858a0ebb3f605932eb938f0e4..f221fd6aff16f2aead8b25f2ba9ddd5673f4760c 100644
--- a/components/guest_view/browser/guest_view_base.cc
+++ b/components/guest_view/browser/guest_view_base.cc
@@ -16,7 +16,7 @@
#include "components/guest_view/common/guest_view_messages.h"
#include "components/zoom/page_zoom.h"
#include "components/zoom/zoom_controller.h"
-#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -70,12 +70,16 @@ class GuestViewBase::OwnerContentsObserver : public WebContentsObserver {
Destroy();
}
- void DidNavigateMainFrame(
- const content::LoadCommittedDetails& details,
- const content::FrameNavigateParams& params) override {
+ void DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) override {
// If the embedder navigates to a different page then destroy the guest.
- if (details.is_navigation_to_different_page())
- Destroy();
+ if (!navigation_handle->IsInMainFrame() ||
+ !navigation_handle->HasCommitted() ||
+ navigation_handle->IsSamePage()) {
+ return;
+ }
+
+ Destroy();
}
void RenderProcessGone(base::TerminationStatus status) override {
@@ -221,9 +225,9 @@ void GuestViewBase::InitWithWebContents(
// after the latter has handled WebContentsObserver events (observers are
// notified of events in the same order they are added as observers). For
// example, GuestViewBase may wish to put its guest into isolated zoom mode
- // in DidNavigateMainFrame, but since ZoomController always resets to default
+ // in DidFinishNavigation, but since ZoomController always resets to default
// zoom mode on this event, GuestViewBase would need to do so after
- // ZoomController::DidNavigateMainFrame has completed.
+ // ZoomController::DidFinishNavigation has completed.
zoom::ZoomController::CreateForWebContents(guest_web_contents);
// At this point, we have just created the guest WebContents, we need to add
@@ -605,9 +609,11 @@ void GuestViewBase::WebContentsDestroyed() {
delete this;
}
-void GuestViewBase::DidNavigateMainFrame(
- const content::LoadCommittedDetails& details,
- const content::FrameNavigateParams& params) {
+void GuestViewBase::DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted())
+ return;
+
if (attached() && ZoomPropagatesFromEmbedderToGuest())
SetGuestZoomLevelToMatchEmbedder();
}
« no previous file with comments | « components/guest_view/browser/guest_view_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698