This patch allows the webview.partitions.accessible_resources entry in chrome app manifests to work fully as intended.

Previously, web pages attempting to use resources specified as webview accessible would fail to load those resources. This happened because a check in the renderer would stop the resource request from being made before the request ever reached the browser process where the webview accessible resources are checked in the manifest. This patch corrects this problem by propagating webview partition IDs to webview guest renderer processes, so that they can check the correct entry in the manifest for accessible resources and allow valid requests to go through to the browser process.

BUG=460797

Review URL: https://codereview.chromium.org/1312653003

Cr-Commit-Position: refs/heads/master@{#347936}
diff --git a/extensions/browser/renderer_startup_helper.cc b/extensions/browser/renderer_startup_helper.cc
index 51dcbdd..917a35b 100644
--- a/extensions/browser/renderer_startup_helper.cc
+++ b/extensions/browser/renderer_startup_helper.cc
@@ -12,6 +12,7 @@
 #include "extensions/browser/extension_function_dispatcher.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/browser/extensions_browser_client.h"
+#include "extensions/browser/guest_view/web_view/web_view_guest.h"
 #include "extensions/common/extension_messages.h"
 #include "extensions/common/extension_set.h"
 #include "extensions/common/extensions_client.h"
@@ -51,6 +52,14 @@
   process->Send(new ExtensionMsg_SetScriptingWhitelist(
       extensions::ExtensionsClient::Get()->GetScriptingWhitelist()));
 
+  // If the new render process is a WebView guest process, propagate the WebView
+  // partition ID to it.
+  std::string webview_partition_id = WebViewGuest::GetPartitionID(process);
+  if (!webview_partition_id.empty()) {
+    process->Send(new ExtensionMsg_SetWebViewPartitionID(
+        WebViewGuest::GetPartitionID(process)));
+  }
+
   // Loaded extensions.
   std::vector<ExtensionMsg_Loaded_Params> loaded_extensions;
   const ExtensionSet& extensions =