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

Unified Diff: chrome/browser/extensions/tab_helper.cc

Issue 2465813002: Fix content script injection for cancelled loads with PlzNavigate. (Closed)
Patch Set: Created 4 years, 1 month 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
Index: chrome/browser/extensions/tab_helper.cc
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index db27af954d9d819fc70925105e29c416e54434bb..34be9d5e9095fd2baa83ec64fbc4ae3a68a9a430 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -40,6 +40,7 @@
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
@@ -47,6 +48,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/frame_navigate_params.h"
#include "extensions/browser/api/declarative/rules_registry_service.h"
#include "extensions/browser/extension_prefs.h"
@@ -62,6 +64,7 @@
#include "extensions/common/extension_urls.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
+#include "net/http/http_response_headers.h"
#include "url/url_constants.h"
#if defined(OS_WIN)
@@ -312,6 +315,17 @@ void TabHelper::RenderFrameCreated(content::RenderFrameHost* host) {
SetTabId(host);
}
+void TabHelper::DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (content::IsBrowserSideNavigationEnabled() &&
+ navigation_handle->GetResponseHeaders() &&
+ (navigation_handle->GetResponseHeaders()->response_code() == 204 ||
+ navigation_handle->GetResponseHeaders()->response_code() == 205)) {
+ content::RenderFrameHost* rfh = navigation_handle->GetRenderFrameHost();
+ rfh->Send(new ExtensionMsg_Set204Or205Error(rfh->GetRoutingID()));
+ }
+}
+
void TabHelper::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {

Powered by Google App Engine
This is Rietveld 408576698