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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 2646423003: Fix regression of webview loadstart events firing for same page navigations.
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 unified diff | Download patch
OLDNEW
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 "extensions/browser/guest_view/web_view/web_view_guest.h" 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 args->SetInteger(webview::kInternalProcessId, 855 args->SetInteger(webview::kInternalProcessId,
856 web_contents()->GetRenderProcessHost()->GetID()); 856 web_contents()->GetRenderProcessHost()->GetID());
857 DispatchEventToView(base::MakeUnique<GuestViewEvent>( 857 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
858 webview::kEventLoadCommit, std::move(args))); 858 webview::kEventLoadCommit, std::move(args)));
859 859
860 find_helper_.CancelAllFindSessions(); 860 find_helper_.CancelAllFindSessions();
861 } 861 }
862 862
863 void WebViewGuest::DidStartNavigation( 863 void WebViewGuest::DidStartNavigation(
864 content::NavigationHandle* navigation_handle) { 864 content::NavigationHandle* navigation_handle) {
865 // loadStart shouldn't be sent for same page navigations.
866 if (navigation_handle->IsSamePage())
867 return;
868
865 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 869 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
866 args->SetString(guest_view::kUrl, navigation_handle->GetURL().spec()); 870 args->SetString(guest_view::kUrl, navigation_handle->GetURL().spec());
867 args->SetBoolean(guest_view::kIsTopLevel, navigation_handle->IsInMainFrame()); 871 args->SetBoolean(guest_view::kIsTopLevel, navigation_handle->IsInMainFrame());
868 DispatchEventToView(base::MakeUnique<GuestViewEvent>(webview::kEventLoadStart, 872 DispatchEventToView(base::MakeUnique<GuestViewEvent>(webview::kEventLoadStart,
869 std::move(args))); 873 std::move(args)));
870 } 874 }
871 875
872 void WebViewGuest::RenderProcessGone(base::TerminationStatus status) { 876 void WebViewGuest::RenderProcessGone(base::TerminationStatus status) {
873 // Cancel all find sessions in progress. 877 // Cancel all find sessions in progress.
874 find_helper_.CancelAllFindSessions(); 878 find_helper_.CancelAllFindSessions();
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 1522 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1519 DispatchEventToView(base::MakeUnique<GuestViewEvent>( 1523 DispatchEventToView(base::MakeUnique<GuestViewEvent>(
1520 webview::kEventExitFullscreen, std::move(args))); 1524 webview::kEventExitFullscreen, std::move(args)));
1521 } 1525 }
1522 // Since we changed fullscreen state, sending a Resize message ensures that 1526 // Since we changed fullscreen state, sending a Resize message ensures that
1523 // renderer/ sees the change. 1527 // renderer/ sees the change.
1524 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); 1528 web_contents()->GetRenderViewHost()->GetWidget()->WasResized();
1525 } 1529 }
1526 1530
1527 } // namespace extensions 1531 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698