Make NetworkIsolationKey use SchemefulSite.

There's still a constructor that takes Origins that needs to be removed,
once consumers are migrated.

Bug: 1145294
Change-Id: Iba1836f47e99d2f0ff66a5f6b6bcb878e6b218f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2538317
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Reviewed-by: Shivani Sharma <[email protected]>
Commit-Queue: Matt Menke <[email protected]>
Cr-Commit-Position: refs/heads/master@{#829512}
diff --git a/net/base/isolation_info.cc b/net/base/isolation_info.cc
index 0980f71..743ce7f 100644
--- a/net/base/isolation_info.cc
+++ b/net/base/isolation_info.cc
@@ -130,10 +130,12 @@
   if (!network_isolation_key.IsFullyPopulated())
     return IsolationInfo();
 
-  url::Origin top_frame_origin = *network_isolation_key.GetTopFrameSite();
+  // TODO(https://crbug.com/1148927): Use null origins in this case.
+  url::Origin top_frame_origin =
+      network_isolation_key.GetTopFrameSite()->site_as_origin_;
   url::Origin frame_origin;
   if (network_isolation_key.GetFrameSite().has_value()) {
-    frame_origin = *network_isolation_key.GetFrameSite();
+    frame_origin = network_isolation_key.GetFrameSite()->site_as_origin_;
   } else if (request_type == RequestType::kMainFrame) {
     frame_origin = top_frame_origin;
   } else {
@@ -197,10 +199,11 @@
       top_frame_origin_(top_frame_origin),
       frame_origin_(frame_origin),
       network_isolation_key_(
-          !top_frame_origin ? NetworkIsolationKey()
-                            : NetworkIsolationKey(*top_frame_origin,
-                                                  *frame_origin,
-                                                  opaque_and_non_transient)),
+          !top_frame_origin
+              ? NetworkIsolationKey()
+              : NetworkIsolationKey(SchemefulSite(*top_frame_origin),
+                                    SchemefulSite(*frame_origin),
+                                    opaque_and_non_transient)),
       site_for_cookies_(site_for_cookies),
       opaque_and_non_transient_(opaque_and_non_transient) {
   DCHECK(IsConsistent(request_type_, top_frame_origin_, frame_origin_,