Revert "Take scheme in CookieStore::SetCanonicalCookieAsync, not just whether it's secure."

This reverts commit 5760a6f2d7a24ee7e2cfac2c399f8756db91be83.

Reason for revert: Clashed with some other change so all Android builders died with:

[1078/8826] CXX obj/android_webview/common/aw_cookie_manager_wrapper.o
FAILED: obj/android_webview/common/aw_cookie_manager_wrapper.o 
../../android_webview/browser/net_network_service/aw_cookie_manager_wrapper.cc -o obj/android_webview/common/aw_cookie_manager_wrapper.o
../../android_webview/browser/net_network_service/aw_cookie_manager_wrapper.cc:40:43: error: reference to type 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') could not bind to an lvalue of type 'bool'
  cookie_manager_->SetCanonicalCookie(cc, secure_source, modify_http_only,
                                          ^~~~~~~~~~~~~
gen/services/network/public/mojom/cookie_manager.mojom.h:179:82: note: passing argument to parameter 'source_scheme' here
  void SetCanonicalCookie(const net::CanonicalCookie& cookie, const std::string& source_scheme, bool modify_http_only, SetCanonicalCookieCallback callback) final;
                                                                                 ^
1 error generated.


Original change's description:
> Take scheme in CookieStore::SetCanonicalCookieAsync, not just whether it's secure.
> 
> This permits to check it against list of cookieable schemes (fixing #850044), and is
> a prerequisite for getting rid of SetCookieWithOptionsAsync in favor of everything
> using SetCanonicalCookieAsync.
> 
> Bug: 850044
> Change-Id: I890cf266767a124b116fc553932a74b5a97ed943
> Reviewed-on: https://chromium-review.googlesource.com/c/1450420
> Commit-Queue: Maks Orlovich <morlovich@chromium.org>
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
> Reviewed-by: Eugene But <eugenebut@chromium.org>
> Reviewed-by: Mike West <mkwst@chromium.org>
> Reviewed-by: Tom Sepez <tsepez@chromium.org>
> Reviewed-by: Victor Costan <pwnall@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#634646}

TBR=jam@chromium.org,caseq@chromium.org,tsepez@chromium.org,eugenebut@chromium.org,pwnall@chromium.org,mkwst@chromium.org,morlovich@chromium.org

Change-Id: I17b82ee596c4cdcebfc8774f06b7e155ead8c514
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 850044
Reviewed-on: https://chromium-review.googlesource.com/c/1482460
Reviewed-by: Daniel Bratell <bratell@opera.com>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#634658}
diff --git a/android_webview/browser/net/aw_cookie_store_wrapper.cc b/android_webview/browser/net/aw_cookie_store_wrapper.cc
index 2fdb2392..33fc9ac 100644
--- a/android_webview/browser/net/aw_cookie_store_wrapper.cc
+++ b/android_webview/browser/net/aw_cookie_store_wrapper.cc
@@ -27,12 +27,11 @@
 
 void SetCanonicalCookieAsyncOnCookieThread(
     std::unique_ptr<net::CanonicalCookie> cookie,
-    std::string source_scheme,
+    bool secure_source,
     bool modify_http_only,
     net::CookieStore::SetCookiesCallback callback) {
   GetCookieStore()->SetCanonicalCookieAsync(
-      std::move(cookie), std::move(source_scheme), modify_http_only,
-      std::move(callback));
+      std::move(cookie), secure_source, modify_http_only, std::move(callback));
 }
 
 void GetCookieListWithOptionsAsyncOnCookieThread(
@@ -103,13 +102,13 @@
 
 void AwCookieStoreWrapper::SetCanonicalCookieAsync(
     std::unique_ptr<net::CanonicalCookie> cookie,
-    std::string source_scheme,
+    bool secure_source,
     bool modify_http_only,
     SetCookiesCallback callback) {
   DCHECK(client_task_runner_->RunsTasksInCurrentSequence());
   PostTaskToCookieStoreTaskRunner(base::BindOnce(
-      &SetCanonicalCookieAsyncOnCookieThread, std::move(cookie),
-      std::move(source_scheme), modify_http_only,
+      &SetCanonicalCookieAsyncOnCookieThread, std::move(cookie), secure_source,
+      modify_http_only,
       CreateWrappedCallback<net::CanonicalCookie::CookieInclusionStatus>(
           std::move(callback))));
 }
diff --git a/android_webview/browser/net/aw_cookie_store_wrapper.h b/android_webview/browser/net/aw_cookie_store_wrapper.h
index 7436105..dc55e5a 100644
--- a/android_webview/browser/net/aw_cookie_store_wrapper.h
+++ b/android_webview/browser/net/aw_cookie_store_wrapper.h
@@ -48,7 +48,7 @@
                                  const net::CookieOptions& options,
                                  SetCookiesCallback callback) override;
   void SetCanonicalCookieAsync(std::unique_ptr<net::CanonicalCookie> cookie,
-                               std::string source_scheme,
+                               bool secure_source,
                                bool modify_http_only,
                                SetCookiesCallback callback) override;
   void GetCookieListWithOptionsAsync(const GURL& url,
diff --git a/chrome/browser/android/cookies/cookies_fetcher_util.cc b/chrome/browser/android/cookies/cookies_fetcher_util.cc
index e018240..c61cdc6e 100644
--- a/chrome/browser/android/cookies/cookies_fetcher_util.cc
+++ b/chrome/browser/android/cookies/cookies_fetcher_util.cc
@@ -111,6 +111,6 @@
   // Assume HTTPS - since the cookies are being restored from another store,
   // they have already gone through the strict secure check.
   GetCookieServiceClient()->SetCanonicalCookie(
-      *cookie, "https", true /* modify_http_only */,
+      *cookie, true /* secure_source */, true /* modify_http_only */,
       network::mojom::CookieManager::SetCanonicalCookieCallback());
 }
diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
index 5a311f6..175217b 100644
--- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
@@ -112,34 +112,38 @@
 
   void CreateCookiesForTest() {
     auto cookie1 =
-        net::CanonicalCookie::Create(GURL("https://www.google.com"), "A=1",
+        net::CanonicalCookie::Create(GURL("http://www.google.com"), "A=1",
                                      base::Time::Now(), net::CookieOptions());
-    auto cookie2 = net::CanonicalCookie::Create(
-        GURL("https://www.gmail.google.com"), "B=1", base::Time::Now(),
-        net::CookieOptions());
+    auto cookie2 =
+        net::CanonicalCookie::Create(GURL("http://www.gmail.google.com"), "B=1",
+                                     base::Time::Now(), net::CookieOptions());
 
     network::mojom::CookieManager* cookie_manager =
         storage_partition()->GetCookieManagerForBrowserProcess();
-    cookie_manager->SetCanonicalCookie(
-        *cookie1, "https", false /* modify_http_only */, base::DoNothing());
-    cookie_manager->SetCanonicalCookie(
-        *cookie2, "https", false /* modify_http_only */, base::DoNothing());
+    cookie_manager->SetCanonicalCookie(*cookie1, true /* secure_source */,
+                                       false /* modify_http_only */,
+                                       base::DoNothing());
+    cookie_manager->SetCanonicalCookie(*cookie2, true /* secure_source */,
+                                       false /* modify_http_only */,
+                                       base::DoNothing());
   }
 
   void CreateCookiesForDomainCookieTest() {
     auto cookie1 =
-        net::CanonicalCookie::Create(GURL("https://www.google.com"), "A=1",
+        net::CanonicalCookie::Create(GURL("http://www.google.com"), "A=1",
                                      base::Time::Now(), net::CookieOptions());
     auto cookie2 = net::CanonicalCookie::Create(
-        GURL("https://www.google.com"), "A=2; Domain=.www.google.com ",
+        GURL("http://www.google.com"), "A=2; Domain=.www.google.com ",
         base::Time::Now(), net::CookieOptions());
 
     network::mojom::CookieManager* cookie_manager =
         storage_partition()->GetCookieManagerForBrowserProcess();
-    cookie_manager->SetCanonicalCookie(
-        *cookie1, "https", false /* modify_http_only */, base::DoNothing());
-    cookie_manager->SetCanonicalCookie(
-        *cookie2, "https", false /* modify_http_only */, base::DoNothing());
+    cookie_manager->SetCanonicalCookie(*cookie1, true /* secure_source */,
+                                       false /* modify_http_only */,
+                                       base::DoNothing());
+    cookie_manager->SetCanonicalCookie(*cookie2, true /* secure_source */,
+                                       false /* modify_http_only */,
+                                       base::DoNothing());
   }
 
   void FetchCallback(const net::CookieList& cookies) {
diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
index 7e0b089..fd8ae34c 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc
@@ -282,8 +282,7 @@
   network::mojom::CookieManager* cookie_manager =
       content::BrowserContext::GetDefaultStoragePartition(profile)
           ->GetCookieManagerForBrowserProcess();
-  cookie_manager->SetCanonicalCookie(cookie, "https", true,
-                                     std::move(callback));
+  cookie_manager->SetCanonicalCookie(cookie, true, true, std::move(callback));
   loop.Run();
   return success;
 }
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc
index 60f6d8b..a331a97 100644
--- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc
+++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc
@@ -283,7 +283,7 @@
     auto cookie = net::CanonicalCookie::Create(
         kOrigin1, "A=1", base::Time::Now(), net::CookieOptions());
     cookie_manager_->SetCanonicalCookie(
-        *cookie, "http", /*modify_http_only=*/false,
+        *cookie, /*secure_source=*/false, /*modify_http_only=*/false,
         base::BindLambdaForTesting([&](bool result) {
           EXPECT_TRUE(result);
           run_loop.Quit();
diff --git a/chrome/browser/browsing_data/counters/site_data_counting_helper_unittest.cc b/chrome/browser/browsing_data/counters/site_data_counting_helper_unittest.cc
index 6b3e8b0..dc184dff 100644
--- a/chrome/browser/browsing_data/counters/site_data_counting_helper_unittest.cc
+++ b/chrome/browser/browsing_data/counters/site_data_counting_helper_unittest.cc
@@ -57,7 +57,7 @@
               time, url.SchemeIsCryptographic(), false,
               net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT);
       cookie_manager->SetCanonicalCookie(
-          *cookie, url.scheme(), true /*modify_http_only*/,
+          *cookie, url.SchemeIsCryptographic(), true /*modify_http_only*/,
           base::BindLambdaForTesting([&](bool result) {
             if (--tasks == 0)
               run_loop.Quit();
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.cc b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.cc
index 75d7cec..1973dd1 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.cc
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl.cc
@@ -88,7 +88,7 @@
               base::Time::Now() /* last_access_time */, true /* secure */,
               false /* http_only */, net::CookieSameSite::STRICT_MODE,
               net::COOKIE_PRIORITY_DEFAULT),
-          "https", false /* modify_http_only */,
+          true /* secure_source */, false /* modify_http_only */,
           base::BindOnce(&AndroidSmsAppSetupControllerImpl::
                              OnSetRememberDeviceByDefaultCookieResult,
                          weak_ptr_factory_.GetWeakPtr(), app_url, install_url,
@@ -275,7 +275,7 @@
               base::Time::Now() /* last_access_time */, true /* secure */,
               false /* http_only */, net::CookieSameSite::STRICT_MODE,
               net::COOKIE_PRIORITY_DEFAULT),
-          "https", false /* modify_http_only */,
+          true /* secure_source */, false /* modify_http_only */,
           base::BindOnce(
               &AndroidSmsAppSetupControllerImpl::OnSetMigrationCookieResult,
               weak_ptr_factory_.GetWeakPtr(), app_url, std::move(callback)));
diff --git a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc
index e92ecc0d..cef8018 100644
--- a/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc
+++ b/chrome/browser/chromeos/android_sms/android_sms_app_setup_controller_impl_unittest.cc
@@ -61,7 +61,7 @@
   void InvokePendingSetCanonicalCookieCallback(
       const std::string& expected_cookie_name,
       const std::string& expected_cookie_value,
-      const std::string& expected_source_scheme,
+      bool expected_secure_source,
       bool expected_modify_http_only,
       bool success) {
     ASSERT_FALSE(set_canonical_cookie_calls_.empty());
@@ -70,7 +70,7 @@
 
     EXPECT_EQ(expected_cookie_name, std::get<0>(params).Name());
     EXPECT_EQ(expected_cookie_value, std::get<0>(params).Value());
-    EXPECT_EQ(expected_source_scheme, std::get<1>(params));
+    EXPECT_EQ(expected_secure_source, std::get<1>(params));
     EXPECT_EQ(expected_modify_http_only, std::get<2>(params));
 
     std::move(std::get<3>(params)).Run(success);
@@ -92,11 +92,11 @@
 
   // network::mojom::CookieManager
   void SetCanonicalCookie(const net::CanonicalCookie& cookie,
-                          const std::string& source_scheme,
+                          bool secure_source,
                           bool modify_http_only,
                           SetCanonicalCookieCallback callback) override {
     set_canonical_cookie_calls_.emplace_back(
-        cookie, source_scheme, modify_http_only, std::move(callback));
+        cookie, secure_source, modify_http_only, std::move(callback));
   }
 
   void DeleteCookies(network::mojom::CookieDeletionFilterPtr filter,
@@ -105,10 +105,8 @@
   }
 
  private:
-  std::vector<std::tuple<net::CanonicalCookie,
-                         std::string,
-                         bool,
-                         SetCanonicalCookieCallback>>
+  std::vector<
+      std::tuple<net::CanonicalCookie, bool, bool, SetCanonicalCookieCallback>>
       set_canonical_cookie_calls_;
   std::vector<
       std::pair<network::mojom::CookieDeletionFilterPtr, DeleteCookiesCallback>>
@@ -208,8 +206,7 @@
 
     fake_cookie_manager_->InvokePendingSetCanonicalCookieCallback(
         "default_to_persist" /* expected_cookie_name */,
-        "true" /* expected_cookie_value */,
-        "https" /* expected_source_scheme */,
+        "true" /* expected_cookie_value */, true /* expected_secure_source */,
         false /* expected_modify_http_only */, true /* success */);
 
     fake_cookie_manager_->InvokePendingDeleteCookiesCallback(
@@ -281,7 +278,7 @@
       fake_cookie_manager_->InvokePendingSetCanonicalCookieCallback(
           "cros_migrated_to" /* expected_cookie_name */,
           migrated_to_app_url.GetContent() /* expected_cookie_value */,
-          "https" /* expected_source_scheme */,
+          true /* expected_secure_source */,
           false /* expected_modify_http_only */, true /* success */);
 
       fake_cookie_manager_->InvokePendingDeleteCookiesCallback(
diff --git a/chrome/browser/chromeos/login/profile_auth_data.cc b/chrome/browser/chromeos/login/profile_auth_data.cc
index ff6cd96..68ea921 100644
--- a/chrome/browser/chromeos/login/profile_auth_data.cc
+++ b/chrome/browser/chromeos/login/profile_auth_data.cc
@@ -81,7 +81,7 @@
     // another store, they have already gone through the strict secure check.
     DCHECK(cookie.IsCanonical());
     cookie_manager->SetCanonicalCookie(
-        cookie, "https", true /*modify_http_only*/,
+        cookie, true /*secure_source*/, true /*modify_http_only*/,
         base::BindOnce(&OnCookieSet, cookie_completion_callback));
   }
 }
diff --git a/chrome/browser/chromeos/login/profile_auth_data_unittest.cc b/chrome/browser/chromeos/login/profile_auth_data_unittest.cc
index 29adacc..fb0801f 100644
--- a/chrome/browser/chromeos/login/profile_auth_data_unittest.cc
+++ b/chrome/browser/chromeos/login/profile_auth_data_unittest.cc
@@ -187,21 +187,21 @@
           kSAMLIdPCookieDomainWithWildcard, std::string(), base::Time(),
           base::Time(), base::Time(), true, false,
           net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
-      "https", true /*modify_http_only*/, base::DoNothing());
+      true /*secure_source*/, true /*modify_http_only*/, base::DoNothing());
 
   cookies->SetCanonicalCookie(
       *net::CanonicalCookie::CreateSanitizedCookie(
           GURL(kSAMLIdPCookieURL), kCookieName, cookie_value, std::string(),
           std::string(), base::Time(), base::Time(), base::Time(), true, false,
           net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
-      "https", true /*modify_http_only*/, base::DoNothing());
+      true /*secure_source*/, true /*modify_http_only*/, base::DoNothing());
 
   cookies->SetCanonicalCookie(
       *net::CanonicalCookie::CreateSanitizedCookie(
           GURL(kGAIACookieURL), kCookieName, cookie_value, std::string(),
           std::string(), base::Time(), base::Time(), base::Time(), true, false,
           net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
-      "https", true /*modify_http_only*/, base::DoNothing());
+      true /*secure_source*/, true /*modify_http_only*/, base::DoNothing());
 }
 
 net::URLRequestContext* ProfileAuthDataTest::GetRequestContext(
diff --git a/chrome/browser/chromeos/login/webview_login_browsertest.cc b/chrome/browser/chromeos/login/webview_login_browsertest.cc
index e6c54a36..4a4f51d 100644
--- a/chrome/browser/chromeos/login/webview_login_browsertest.cc
+++ b/chrome/browser/chromeos/login/webview_login_browsertest.cc
@@ -90,7 +90,7 @@
                            "/", base::Time(), base::Time(), base::Time(), false,
                            false, net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "http", false,
+      false, false,
       base::Bind(&InjectCookieDoneCallback, run_loop.QuitClosure()));
   run_loop.Run();
 }
diff --git a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
index 9aa0c4c..6dbbc40 100644
--- a/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
+++ b/chrome/browser/extensions/api/browsing_data/browsing_data_test.cc
@@ -70,7 +70,7 @@
       content::BrowserContext::GetDefaultStoragePartition(profile)
           ->GetCookieManagerForBrowserProcess();
   cookie_manager->SetCanonicalCookie(
-      cookie, google_url.scheme(), true,
+      cookie, true, true,
       mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback), false));
   loop.Run();
   return success;
diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc
index 564eb04..69d3bf0 100644
--- a/chrome/browser/extensions/api/cookies/cookies_api.cc
+++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
@@ -369,7 +369,7 @@
   // plus FIFO ordering on the cookie_manager_ pipe means that no
   // other extension function will affect the get result.
   cookie_manager->SetCanonicalCookie(
-      *cc, url_.scheme(), true /*modify_http_only*/,
+      *cc, url_.SchemeIsCryptographic(), true /*modify_http_only*/,
       base::BindOnce(&CookiesSetFunction::SetCanonicalCookieCallback, this));
   cookies_helpers::GetCookieListFromManager(
       cookie_manager, url_,
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 6bf3366..a70122e 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -4992,7 +4992,7 @@
     bool set_result = false;
     base::RunLoop run_loop;
     cookie_manager_ptr->SetCanonicalCookie(
-        *cc.get(), origin1.scheme(), true /* modify_http_only */,
+        *cc.get(), origin1.SchemeIsCryptographic(), true /* modify_http_only */,
         base::BindOnce(&SetCookieSaveData, &set_result,
                        run_loop.QuitClosure()));
     run_loop.Run();
diff --git a/chrome/browser/net/chrome_network_service_browsertest.cc b/chrome/browser/net/chrome_network_service_browsertest.cc
index 0941d01..4d3847d 100644
--- a/chrome/browser/net/chrome_network_service_browsertest.cc
+++ b/chrome/browser/net/chrome_network_service_browsertest.cc
@@ -48,7 +48,7 @@
                               net::COOKIE_PRIORITY_DEFAULT);
   base::RunLoop run_loop;
   cookie_manager->SetCanonicalCookie(
-      cookie, "http", false,
+      cookie, false, false,
       base::BindLambdaForTesting([&](bool success) { run_loop.Quit(); }));
   run_loop.Run();
 }
diff --git a/chrome/browser/profile_resetter/profile_resetter_browsertest.cc b/chrome/browser/profile_resetter/profile_resetter_browsertest.cc
index 8cb6d0a..feef5f6 100644
--- a/chrome/browser/profile_resetter/profile_resetter_browsertest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_browsertest.cc
@@ -93,7 +93,7 @@
                            base::Time(), false, false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "http", true /* modify_http_only */,
+      false /* secure_source */, true /* modify_http_only */,
       base::BindOnce(&RemoveCookieTester::SetCanonicalCookieCallback,
                      base::Unretained(this)));
   BlockUntilNotified();
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index dc9fbd3..ace15b72 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -379,7 +379,8 @@
       net::CookieOptions()));
 
   partition->GetCookieManagerForBrowserProcess()->SetCanonicalCookie(
-      *cc.get(), "https", true /* modify_http_only */, std::move(callback));
+      *cc.get(), true /* secure_source */, true /* modify_http_only */,
+      std::move(callback));
 }
 
 void GaiaScreenHandler::OnSetCookieForLoadGaiaWithPartition(
diff --git a/components/signin/core/browser/gaia_cookie_manager_service.cc b/components/signin/core/browser/gaia_cookie_manager_service.cc
index 3f4b2061..94ab355c 100644
--- a/components/signin/core/browser/gaia_cookie_manager_service.cc
+++ b/components/signin/core/browser/gaia_cookie_manager_service.cc
@@ -1171,7 +1171,7 @@
           &GaiaCookieManagerService::OnCookieSet,
           weak_ptr_factory_.GetWeakPtr(), cookie.Name(), cookie.Domain());
       cookie_manager->SetCanonicalCookie(
-          cookie, "https", true,
+          cookie, true, true,
           mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback),
                                                       false));
     } else {
diff --git a/content/browser/browsing_data/clear_site_data_handler_browsertest.cc b/content/browser/browsing_data/clear_site_data_handler_browsertest.cc
index 763f5e8..4ffa981 100644
--- a/content/browser/browsing_data/clear_site_data_handler_browsertest.cc
+++ b/content/browser/browsing_data/clear_site_data_handler_browsertest.cc
@@ -228,7 +228,7 @@
 
     base::RunLoop run_loop;
     cookie_manager->SetCanonicalCookie(
-        *cookie, url.scheme(), false /* modify_http_only */,
+        *cookie, true /* secure_source */, false /* modify_http_only */,
         base::BindOnce(&ClearSiteDataHandlerBrowserTest::AddCookieCallback,
                        run_loop.QuitClosure()));
     run_loop.Run();
diff --git a/content/browser/cookie_store/cookie_store_manager_unittest.cc b/content/browser/cookie_store/cookie_store_manager_unittest.cc
index 24c6725..59c18ff 100644
--- a/content/browser/cookie_store/cookie_store_manager_unittest.cc
+++ b/content/browser/cookie_store/cookie_store_manager_unittest.cc
@@ -319,7 +319,7 @@
     base::RunLoop run_loop;
     bool success = false;
     cookie_manager_->SetCanonicalCookie(
-        cookie, "https", /* can_modify_httponly = */ true,
+        cookie, /* secure_source = */ true, /* can_modify_httponly = */ true,
         base::BindOnce(
             [](base::RunLoop* run_loop, bool* success, bool service_success) {
               *success = success;
diff --git a/content/browser/devtools/devtools_url_interceptor_request_job.cc b/content/browser/devtools/devtools_url_interceptor_request_job.cc
index 1f6750bd..3149c71 100644
--- a/content/browser/devtools/devtools_url_interceptor_request_job.cc
+++ b/content/browser/devtools/devtools_url_interceptor_request_job.cc
@@ -1080,7 +1080,7 @@
 
       auto* store = request_details_.url_request_context->cookie_store();
       store->SetCanonicalCookieAsync(
-          std::move(cookie), request_details_.url.scheme(),
+          std::move(cookie), request_details_.url.SchemeIsCryptographic(),
           !options.exclude_httponly(), net::CookieStore::SetCookiesCallback());
     }
 
diff --git a/content/browser/devtools/devtools_url_loader_interceptor.cc b/content/browser/devtools/devtools_url_loader_interceptor.cc
index e64ee32..5bc4a1b 100644
--- a/content/browser/devtools/devtools_url_loader_interceptor.cc
+++ b/content/browser/devtools/devtools_url_loader_interceptor.cc
@@ -1060,9 +1060,7 @@
       [](base::RepeatingClosure closure, bool) { closure.Run(); },
       base::BarrierClosure(cookies.size(), std::move(callback)));
   for (auto& cookie : cookies) {
-    cookie_manager_->SetCanonicalCookie(
-        *cookie, create_loader_params_->request.url.scheme(), true,
-        on_cookie_set);
+    cookie_manager_->SetCanonicalCookie(*cookie, true, true, on_cookie_set);
   }
 }
 
diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc
index d6682d7..483ad51 100644
--- a/content/browser/devtools/protocol/network_handler.cc
+++ b/content/browser/devtools/protocol/network_handler.cc
@@ -459,7 +459,7 @@
       context_getter->GetURLRequestContext();
 
   request_context->cookie_store()->SetCanonicalCookieAsync(
-      std::move(cookie), "https" /* source_scheme */, true /*modify_http_only*/,
+      std::move(cookie), true /* secure_source */, true /*modify_http_only*/,
       std::move(callback));
 }
 
@@ -1249,7 +1249,7 @@
   }
 
   storage_partition_->GetCookieManagerForBrowserProcess()->SetCanonicalCookie(
-      *cookie, "https", true /* modify_http_only */,
+      *cookie, true /* secure_source */, true /* modify_http_only */,
       base::BindOnce(&SetCookieCallback::sendSuccess, std::move(callback)));
 }
 
@@ -1296,7 +1296,7 @@
       storage_partition_->GetCookieManagerForBrowserProcess();
   for (const auto& cookie : net_cookies) {
     cookie_manager->SetCanonicalCookie(
-        *cookie, "https", true,
+        *cookie, true, true,
         base::BindOnce(
             [](base::RepeatingClosure callback, bool) { callback.Run(); },
             barrier_closure));
diff --git a/content/browser/frame_host/render_frame_message_filter.cc b/content/browser/frame_host/render_frame_message_filter.cc
index 4fcaadf..62f0099 100644
--- a/content/browser/frame_host/render_frame_message_filter.cc
+++ b/content/browser/frame_host/render_frame_message_filter.cc
@@ -613,8 +613,8 @@
 
     // Pass a null callback since we don't care about when the 'set' completes.
     cookie_store->SetCanonicalCookieAsync(
-        std::move(cookie), url.scheme(), !options.exclude_httponly(),
-        net::CookieStore::SetCookiesCallback());
+        std::move(cookie), url.SchemeIsCryptographic(),
+        !options.exclude_httponly(), net::CookieStore::SetCookiesCallback());
     return;
   }
 
@@ -627,7 +627,8 @@
                          std::move(callback)),
           false);
   (*GetCookieManager())
-      ->SetCanonicalCookie(*cookie, url.scheme(), !options.exclude_httponly(),
+      ->SetCanonicalCookie(*cookie, url.SchemeIsCryptographic(),
+                           !options.exclude_httponly(),
                            std::move(net_callback));
 }
 
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index eadcd51..c2402c94 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -1785,7 +1785,7 @@
   DCHECK(cc.get());
 
   cookie_manager->SetCanonicalCookie(
-      *cc.get(), url.scheme(), true /* modify_http_only */,
+      *cc.get(), true /* secure_source */, true /* modify_http_only */,
       base::BindOnce(
           [](bool* result, base::RunLoop* run_loop, bool success) {
             *result = success;
diff --git a/ios/chrome/browser/signin/gaia_auth_fetcher_ios_ns_url_session_bridge.mm b/ios/chrome/browser/signin/gaia_auth_fetcher_ios_ns_url_session_bridge.mm
index c816de0..2703b29 100644
--- a/ios/chrome/browser/signin/gaia_auth_fetcher_ios_ns_url_session_bridge.mm
+++ b/ios/chrome/browser/signin/gaia_auth_fetcher_ios_ns_url_session_bridge.mm
@@ -118,8 +118,8 @@
   for (NSHTTPCookie* cookie : cookies) {
     cookie_manager->SetCanonicalCookie(
         net::CanonicalCookieFromSystemCookie(cookie, base::Time::Now()),
-        base::SysNSStringToUTF8(response.URL.scheme), /*modify_http_only=*/true,
-        base::DoNothing());
+        /*secure_source=*/true,
+        /*modify_http_only=*/true, base::DoNothing());
   }
 }
 
diff --git a/ios/chrome/browser/signin/gaia_auth_fetcher_ios_ns_url_session_bridge_unittests.mm b/ios/chrome/browser/signin/gaia_auth_fetcher_ios_ns_url_session_bridge_unittests.mm
index 670f595c..c3349e0 100644
--- a/ios/chrome/browser/signin/gaia_auth_fetcher_ios_ns_url_session_bridge_unittests.mm
+++ b/ios/chrome/browser/signin/gaia_auth_fetcher_ios_ns_url_session_bridge_unittests.mm
@@ -261,7 +261,8 @@
   for (NSHTTPCookie* cookie in cookies) {
     cookie_manager->SetCanonicalCookie(
         net::CanonicalCookieFromSystemCookie(cookie, base::Time::Now()),
-        "https", /*modify_http_only=*/true, base::DoNothing());
+        /*secure_source=*/true,
+        /*modify_http_only=*/true, base::DoNothing());
   }
   WaitForBackgroundTasks();
 }
diff --git a/ios/net/cookies/cookie_store_ios.h b/ios/net/cookies/cookie_store_ios.h
index d859679..9cf07461 100644
--- a/ios/net/cookies/cookie_store_ios.h
+++ b/ios/net/cookies/cookie_store_ios.h
@@ -88,7 +88,7 @@
                                  const net::CookieOptions& options,
                                  SetCookiesCallback callback) override;
   void SetCanonicalCookieAsync(std::unique_ptr<CanonicalCookie> cookie,
-                               std::string source_scheme,
+                               bool secure_source,
                                bool modify_http_only,
                                SetCookiesCallback callback) override;
   void GetCookieListWithOptionsAsync(const GURL& url,
diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm
index 92df7be..d2d8581 100644
--- a/ios/net/cookies/cookie_store_ios.mm
+++ b/ios/net/cookies/cookie_store_ios.mm
@@ -340,7 +340,7 @@
 
 void CookieStoreIOS::SetCanonicalCookieAsync(
     std::unique_ptr<net::CanonicalCookie> cookie,
-    std::string source_scheme,
+    bool secure_source,
     bool modify_http_only,
     SetCookiesCallback callback) {
   DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
@@ -354,9 +354,6 @@
   // engine.
   DCHECK(modify_http_only);
 
-  bool secure_source =
-      GURL::SchemeIsCryptographic(base::ToLowerASCII(source_scheme));
-
   if (cookie->IsSecure() && !secure_source) {
     if (!callback.is_null())
       std::move(callback).Run(
diff --git a/ios/net/cookies/cookie_store_ios_persistent.h b/ios/net/cookies/cookie_store_ios_persistent.h
index 7a0a5170..46b5fef 100644
--- a/ios/net/cookies/cookie_store_ios_persistent.h
+++ b/ios/net/cookies/cookie_store_ios_persistent.h
@@ -47,7 +47,7 @@
                                  const net::CookieOptions& options,
                                  SetCookiesCallback callback) override;
   void SetCanonicalCookieAsync(std::unique_ptr<CanonicalCookie> cookie,
-                               std::string source_scheme,
+                               bool secure_source,
                                bool modify_http_only,
                                SetCookiesCallback callback) override;
   void GetCookieListWithOptionsAsync(const GURL& url,
diff --git a/ios/net/cookies/cookie_store_ios_persistent.mm b/ios/net/cookies/cookie_store_ios_persistent.mm
index c117783..d779f89 100644
--- a/ios/net/cookies/cookie_store_ios_persistent.mm
+++ b/ios/net/cookies/cookie_store_ios_persistent.mm
@@ -70,13 +70,13 @@
 
 void CookieStoreIOSPersistent::SetCanonicalCookieAsync(
     std::unique_ptr<CanonicalCookie> cookie,
-    std::string source_scheme,
+    bool secure_source,
     bool modify_http_only,
     SetCookiesCallback callback) {
   DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
 
   cookie_monster()->SetCanonicalCookieAsync(
-      std::move(cookie), std::move(source_scheme), modify_http_only,
+      std::move(cookie), secure_source, modify_http_only,
       WrapSetCallback(std::move(callback)));
 }
 
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index 4fa8571..2152392 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -419,7 +419,7 @@
 
 void CookieMonster::SetCanonicalCookieAsync(
     std::unique_ptr<CanonicalCookie> cookie,
-    std::string source_scheme,
+    bool secure_source,
     bool modify_http_only,
     SetCookiesCallback callback) {
   DCHECK(cookie->IsCanonical());
@@ -431,7 +431,7 @@
           // the callback on |*this|, so the callback will not outlive
           // the object.
           &CookieMonster::SetCanonicalCookie, base::Unretained(this),
-          std::move(cookie), std::move(source_scheme), modify_http_only,
+          std::move(cookie), secure_source, modify_http_only,
           std::move(callback)),
       domain);
 }
@@ -728,8 +728,8 @@
   }
 
   DCHECK(cc);
-  SetCanonicalCookie(std::move(cc), url.scheme(), !options.exclude_httponly(),
-                     std::move(callback));
+  SetCanonicalCookie(std::move(cc), url.SchemeIsCryptographic(),
+                     !options.exclude_httponly(), std::move(callback));
 }
 
 void CookieMonster::DeleteCanonicalCookie(const CanonicalCookie& cookie,
@@ -1202,13 +1202,11 @@
 }
 
 void CookieMonster::SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cc,
-                                       std::string source_scheme,
+                                       bool secure_source,
                                        bool modify_http_only,
                                        SetCookiesCallback callback) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
-  std::string scheme_lower = base::ToLowerASCII(source_scheme);
-  bool secure_source = GURL::SchemeIsCryptographic(scheme_lower);
   if ((cc->IsSecure() && !secure_source)) {
     MaybeRunCookieCallback(
         std::move(callback),
@@ -1223,13 +1221,6 @@
     return;
   }
 
-  if (!IsCookieableScheme(scheme_lower)) {
-    MaybeRunCookieCallback(
-        std::move(callback),
-        CanonicalCookie::CookieInclusionStatus::EXCLUDE_NONCOOKIEABLE_SCHEME);
-    return;
-  }
-
   const std::string key(GetKey(cc->Domain()));
 
   base::Time creation_date = cc->CreationDate();
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index b9aeaaf..680df39 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -161,7 +161,7 @@
                                  const CookieOptions& options,
                                  SetCookiesCallback callback) override;
   void SetCanonicalCookieAsync(std::unique_ptr<CanonicalCookie> cookie,
-                               std::string source_scheme,
+                               bool secure_source,
                                bool modify_http_only,
                                SetCookiesCallback callback) override;
   void GetCookieListWithOptionsAsync(const GURL& url,
@@ -364,7 +364,7 @@
   // |modify_http_only| indicates if this setting operation is allowed
   // to affect http_only cookies.
   void SetCanonicalCookie(std::unique_ptr<CanonicalCookie> cookie,
-                          std::string source_scheme,
+                          bool secure_source,
                           bool can_modify_httponly,
                           SetCookiesCallback callback);
 
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index b4c354c..e20ef24 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -188,7 +188,7 @@
     cm->SetCanonicalCookieAsync(
         CanonicalCookie::Create(url, cookie_line, creation_time,
                                 CookieOptions()),
-        url.scheme(), /* modify_httponly = */ false,
+        url.SchemeIsCryptographic(), /* modify_httponly = */ false,
         base::BindOnce(&ResultSavingCookieCallback<
                            CanonicalCookie::CookieInclusionStatus>::Run,
                        base::Unretained(&callback)));
@@ -246,21 +246,21 @@
             "dom_1", "A", ".harvard.edu", "/", base::Time(), base::Time(),
             base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
             COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
     EXPECT_TRUE(this->SetCanonicalCookie(
         cm,
         std::make_unique<CanonicalCookie>(
             "dom_2", "B", ".math.harvard.edu", "/", base::Time(), base::Time(),
             base::Time(), false, false, CookieSameSite::DEFAULT_MODE,
             COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
     EXPECT_TRUE(this->SetCanonicalCookie(
         cm,
         std::make_unique<CanonicalCookie>(
             "dom_3", "C", ".bourbaki.math.harvard.edu", "/", base::Time(),
             base::Time(), base::Time(), false, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
 
     // Host cookies
     EXPECT_TRUE(this->SetCanonicalCookie(
@@ -269,21 +269,21 @@
             "host_1", "A", url_top_level_domain_plus_1, "/", base::Time(),
             base::Time(), base::Time(), false, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
     EXPECT_TRUE(this->SetCanonicalCookie(
         cm,
         std::make_unique<CanonicalCookie>(
             "host_2", "B", url_top_level_domain_plus_2, "/", base::Time(),
             base::Time(), base::Time(), false, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
     EXPECT_TRUE(this->SetCanonicalCookie(
         cm,
         std::make_unique<CanonicalCookie>(
             "host_3", "C", url_top_level_domain_plus_3, "/", base::Time(),
             base::Time(), base::Time(), false, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
 
     // http_only cookie
     EXPECT_TRUE(this->SetCanonicalCookie(
@@ -292,7 +292,7 @@
             "httpo_check", "A", url_top_level_domain_plus_2, "/", base::Time(),
             base::Time(), base::Time(), false, true,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
 
     // same-site cookie
     EXPECT_TRUE(this->SetCanonicalCookie(
@@ -301,7 +301,7 @@
             "firstp_check", "A", url_top_level_domain_plus_2, "/", base::Time(),
             base::Time(), base::Time(), false, false,
             CookieSameSite::STRICT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
 
     // Secure cookies
     EXPECT_TRUE(this->SetCanonicalCookie(
@@ -310,7 +310,7 @@
             "sec_dom", "A", ".math.harvard.edu", "/", base::Time(),
             base::Time(), base::Time(), true, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "https", true /*modify_httponly*/));
+        true /*secure_source*/, true /*modify_httponly*/));
 
     EXPECT_TRUE(this->SetCanonicalCookie(
         cm,
@@ -318,7 +318,7 @@
             "sec_host", "B", url_top_level_domain_plus_2, "/", base::Time(),
             base::Time(), base::Time(), true, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "https", true /*modify_httponly*/));
+        true /*secure_source*/, true /*modify_httponly*/));
 
     // Domain path cookies
     EXPECT_TRUE(this->SetCanonicalCookie(
@@ -327,14 +327,14 @@
             "dom_path_1", "A", ".math.harvard.edu", "/dir1", base::Time(),
             base::Time(), base::Time(), false, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
     EXPECT_TRUE(this->SetCanonicalCookie(
         cm,
         std::make_unique<CanonicalCookie>(
             "dom_path_2", "B", ".math.harvard.edu", "/dir1/dir2", base::Time(),
             base::Time(), base::Time(), false, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
 
     // Host path cookies
     EXPECT_TRUE(this->SetCanonicalCookie(
@@ -343,7 +343,7 @@
             "host_path_1", "A", url_top_level_domain_plus_2, "/dir1",
             base::Time(), base::Time(), base::Time(), false, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
 
     EXPECT_TRUE(this->SetCanonicalCookie(
         cm,
@@ -351,7 +351,7 @@
             "host_path_2", "B", url_top_level_domain_plus_2, "/dir1/dir2",
             base::Time(), base::Time(), base::Time(), false, false,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /*modify_httponly*/));
+        false /*secure_source*/, true /*modify_httponly*/));
 
     EXPECT_EQ(14U, this->GetAllCookies(cm).size());
   }
@@ -1556,42 +1556,16 @@
   GURL foo_url("foo://host/path");
   GURL http_url("http://host/path");
 
-  base::Time now = base::Time::Now();
   EXPECT_EQ(CanonicalCookie::CookieInclusionStatus::INCLUDE,
             SetCookieReturnStatus(cm.get(), http_url, "x=1"));
-  EXPECT_EQ(CanonicalCookie::CookieInclusionStatus::INCLUDE,
-            SetCanonicalCookieReturnStatus(
-                cm.get(),
-                CanonicalCookie::Create(http_url, "y=1", now, CookieOptions()),
-                "http", false /*modify_httponly*/));
-
   EXPECT_EQ(
       CanonicalCookie::CookieInclusionStatus::EXCLUDE_NONCOOKIEABLE_SCHEME,
       SetCookieReturnStatus(cm.get(), foo_url, "x=1"));
-  EXPECT_EQ(
-      CanonicalCookie::CookieInclusionStatus::EXCLUDE_NONCOOKIEABLE_SCHEME,
-      SetCanonicalCookieReturnStatus(
-          cm.get(),
-          CanonicalCookie::Create(foo_url, "y=1", now, CookieOptions()), "foo",
-          false /*modify_httponly*/));
-
   EXPECT_EQ(CanonicalCookie::CookieInclusionStatus::INCLUDE,
             SetCookieReturnStatus(cm_foo.get(), foo_url, "x=1"));
-  EXPECT_EQ(CanonicalCookie::CookieInclusionStatus::INCLUDE,
-            SetCanonicalCookieReturnStatus(
-                cm_foo.get(),
-                CanonicalCookie::Create(foo_url, "y=1", now, CookieOptions()),
-                "foo", false /*modify_httponly*/));
-
   EXPECT_EQ(
       CanonicalCookie::CookieInclusionStatus::EXCLUDE_NONCOOKIEABLE_SCHEME,
       SetCookieReturnStatus(cm_foo.get(), http_url, "x=1"));
-  EXPECT_EQ(
-      CanonicalCookie::CookieInclusionStatus::EXCLUDE_NONCOOKIEABLE_SCHEME,
-      SetCanonicalCookieReturnStatus(
-          cm_foo.get(),
-          CanonicalCookie::Create(http_url, "y=1", now, CookieOptions()),
-          "http", false /*modify_httponly*/));
 }
 
 TEST_F(CookieMonsterTest, GetAllCookiesForURL) {
@@ -2093,7 +2067,7 @@
               cookie.name, cookie.value, cookie.domain, cookie.path,
               base::Time(), cookie.expiration_time, base::Time(), cookie.secure,
               cookie.http_only, cookie.same_site, cookie.priority),
-          cookie.url.scheme(), true /*modify_httponly*/));
+          cookie.url.SchemeIsCryptographic(), true /*modify_httponly*/));
     }
 
     EXPECT_TRUE(FindAndDeleteCookie(cmout.get(),
@@ -2685,7 +2659,7 @@
           "a", "b", "a.url", "/", base::Time(),
           base::Time::Now() + base::TimeDelta::FromMinutes(59), base::Time(),
           false, false, CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-      "http", true /*modify_httponly*/));
+      false /*secure_source*/, true /*modify_httponly*/));
 
   std::unique_ptr<base::HistogramSamples> samples2(
       expired_histogram->SnapshotSamples());
@@ -3301,7 +3275,7 @@
   cm.SetCanonicalCookieAsync(
       CanonicalCookie::Create(GURL("http://a.com/"), "A=B", base::Time::Now(),
                               CookieOptions()),
-      "http", false /* modify_httponly */,
+      false /* secure_source */, false /* modify_httponly */,
       base::BindOnce(&ResultSavingCookieCallback<
                          CanonicalCookie::CookieInclusionStatus>::Run,
                      base::Unretained(&callback_set)));
@@ -3385,7 +3359,8 @@
   ResultSavingCookieCallback<CanonicalCookie::CookieInclusionStatus>
       set_callback_1;
   cm.SetCanonicalCookieAsync(
-      std::move(cookie), url.scheme(), !options.exclude_httponly(),
+      std::move(cookie), url.SchemeIsCryptographic(),
+      !options.exclude_httponly(),
       base::BindOnce(&ResultSavingCookieCallback<
                          CanonicalCookie::CookieInclusionStatus>::Run,
                      base::Unretained(&set_callback_1)));
@@ -3396,7 +3371,8 @@
   ResultSavingCookieCallback<CanonicalCookie::CookieInclusionStatus>
       set_callback_2;
   cm.SetCanonicalCookieAsync(
-      std::move(cookie), url.scheme(), !options.exclude_httponly(),
+      std::move(cookie), url.SchemeIsCryptographic(),
+      !options.exclude_httponly(),
       base::BindOnce(&ResultSavingCookieCallback<
                          CanonicalCookie::CookieInclusionStatus>::Run,
                      base::Unretained(&set_callback_2)));
diff --git a/net/cookies/cookie_store.h b/net/cookies/cookie_store.h
index fb89b5d..086115f3 100644
--- a/net/cookies/cookie_store.h
+++ b/net/cookies/cookie_store.h
@@ -65,12 +65,13 @@
                                          SetCookiesCallback callback) = 0;
 
   // Set the cookie on the cookie store.  |cookie.IsCanonical()| must
-  // be true.  |source_scheme| denotes the scheme of the resource setting this,
-  // and |modify_http_only| indicates if the source of the setting may modify
-  // http_only cookies.  The current time will be used in place of a null
-  // creation time.
+  // be true.  |secure_source| indicates if the source of the setting
+  // may be considered secure (if from a URL, the scheme is
+  // cryptographic), and |modify_http_only| indicates if the source of
+  // the setting may modify http_only cookies.  The current time will
+  // be used in place of a null creation time.
   virtual void SetCanonicalCookieAsync(std::unique_ptr<CanonicalCookie> cookie,
-                                       std::string source_scheme,
+                                       bool secure_source,
                                        bool modify_http_only,
                                        SetCookiesCallback callback) = 0;
 
diff --git a/net/cookies/cookie_store_test_helpers.cc b/net/cookies/cookie_store_test_helpers.cc
index 047082f..022b73a 100644
--- a/net/cookies/cookie_store_test_helpers.cc
+++ b/net/cookies/cookie_store_test_helpers.cc
@@ -106,12 +106,12 @@
 
 void DelayedCookieMonster::SetCanonicalCookieAsync(
     std::unique_ptr<CanonicalCookie> cookie,
-    std::string source_scheme,
+    bool secure_source,
     bool modify_http_only,
     SetCookiesCallback callback) {
   did_run_ = false;
   cookie_monster_->SetCanonicalCookieAsync(
-      std::move(cookie), std::move(source_scheme), modify_http_only,
+      std::move(cookie), secure_source, modify_http_only,
       base::Bind(&DelayedCookieMonster::SetCookiesInternalCallback,
                  base::Unretained(this)));
   DCHECK_EQ(did_run_, true);
diff --git a/net/cookies/cookie_store_test_helpers.h b/net/cookies/cookie_store_test_helpers.h
index 85935fa..eb7934cee 100644
--- a/net/cookies/cookie_store_test_helpers.h
+++ b/net/cookies/cookie_store_test_helpers.h
@@ -58,7 +58,7 @@
       CookieMonster::SetCookiesCallback callback) override;
 
   void SetCanonicalCookieAsync(std::unique_ptr<CanonicalCookie> cookie,
-                               std::string source_scheme,
+                               bool secure_source,
                                bool modify_http_only,
                                SetCookiesCallback callback) override;
 
diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h
index 34f8f23..d546f45 100644
--- a/net/cookies/cookie_store_unittest.h
+++ b/net/cookies/cookie_store_unittest.h
@@ -211,12 +211,12 @@
 
   bool SetCanonicalCookie(CookieStore* cs,
                           std::unique_ptr<CanonicalCookie> cookie,
-                          std::string source_scheme,
+                          bool secure_source,
                           bool can_modify_httponly) {
     DCHECK(cs);
     ResultSavingCookieCallback<CanonicalCookie::CookieInclusionStatus> callback;
     cs->SetCanonicalCookieAsync(
-        std::move(cookie), std::move(source_scheme), can_modify_httponly,
+        std::move(cookie), secure_source, can_modify_httponly,
         base::BindOnce(&ResultSavingCookieCallback<
                            CanonicalCookie::CookieInclusionStatus>::Run,
                        base::Unretained(&callback)));
@@ -266,12 +266,12 @@
   CanonicalCookie::CookieInclusionStatus SetCanonicalCookieReturnStatus(
       CookieStore* cs,
       std::unique_ptr<CanonicalCookie> cookie,
-      std::string source_scheme,
+      bool secure_source,
       bool can_modify_httponly) {
     DCHECK(cs);
     ResultSavingCookieCallback<CanonicalCookie::CookieInclusionStatus> callback;
     cs->SetCanonicalCookieAsync(
-        std::move(cookie), std::move(source_scheme), can_modify_httponly,
+        std::move(cookie), secure_source, can_modify_httponly,
         base::BindOnce(&ResultSavingCookieCallback<
                            CanonicalCookie::CookieInclusionStatus>::Run,
                        base::Unretained(&callback)));
@@ -420,8 +420,8 @@
       one_hour_from_now, base::Time(), false, false,
       CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT));
   ASSERT_TRUE(cc);
-  EXPECT_TRUE(this->SetCanonicalCookie(cs, std::move(cc), "https",
-                                       true /*modify_httponly*/));
+  EXPECT_TRUE(this->SetCanonicalCookie(
+      cs, std::move(cc), true /*secure_source*/, true /*modify_httponly*/));
 
   // Note that for the creation time to be set exactly, without modification,
   // it must be different from the one set by the line above.
@@ -430,8 +430,8 @@
       two_hours_ago, base::Time(), one_hour_ago, false, true,
       CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT);
   ASSERT_TRUE(cc);
-  EXPECT_TRUE(this->SetCanonicalCookie(cs, std::move(cc), "https",
-                                       true /*modify_httponly*/));
+  EXPECT_TRUE(this->SetCanonicalCookie(
+      cs, std::move(cc), true /*secure_source*/, true /*modify_httponly*/));
 
   // Because of strict secure cookies, it should not be possible to create
   // a secure cookie with an HTTP URL.
@@ -447,8 +447,8 @@
       base::Time(), base::Time(), base::Time(), true, false,
       CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT);
   ASSERT_TRUE(cc);
-  EXPECT_TRUE(this->SetCanonicalCookie(cs, std::move(cc), "https",
-                                       true /*modify_httponly*/));
+  EXPECT_TRUE(this->SetCanonicalCookie(
+      cs, std::move(cc), true /*secure_source*/, true /*modify_httponly*/));
 
   // Get all the cookies for a given URL, regardless of properties. This 'get()'
   // operation shouldn't update the access time, as the test checks that the
@@ -552,7 +552,7 @@
           "A", "B", foo_foo_host, "/foo", one_hour_ago, one_hour_from_now,
           base::Time(), false /* secure */, false /* httponly */,
           CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-      "http", true));
+      false /* secure_source */, true));
   // Note that for the creation time to be set exactly, without modification,
   // it must be different from the one set by the line above.
   EXPECT_TRUE(this->SetCanonicalCookie(
@@ -561,7 +561,7 @@
           "C", "D", "." + foo_bar_domain, "/bar", two_hours_ago, base::Time(),
           one_hour_ago, false, true, CookieSameSite::DEFAULT_MODE,
           COOKIE_PRIORITY_DEFAULT),
-      "http", true));
+      false /* secure_source */, true));
 
   // A secure source is required for creating secure cookies.
   EXPECT_EQ(CanonicalCookie::CookieInclusionStatus::EXCLUDE_SECURE_ONLY,
@@ -571,7 +571,7 @@
                     "E", "F", http_foo_host, "/", base::Time(), base::Time(),
                     base::Time(), true, false, CookieSameSite::DEFAULT_MODE,
                     COOKIE_PRIORITY_DEFAULT),
-                "http", true));
+                false /* secure_source */, true));
 
   // A secure source is also required for overwriting secure cookies.  Writing
   // a secure cookie then overwriting it from a non-secure source should fail.
@@ -581,7 +581,7 @@
           "E", "F", http_foo_host, "/", base::Time(), base::Time(),
           base::Time(), true /* secure */, false /* httponly */,
           CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-      "https", true /* modify_http_only */));
+      true /* secure_source */, true /* modify_http_only */));
 
   EXPECT_EQ(CanonicalCookie::CookieInclusionStatus::EXCLUDE_SECURE_ONLY,
             this->SetCanonicalCookieReturnStatus(
@@ -590,7 +590,7 @@
                     "E", "F", http_foo_host, "/", base::Time(), base::Time(),
                     base::Time(), true /* secure */, false /* httponly */,
                     CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-                "http", true /* modify_http_only */));
+                false /* secure_source */, true /* modify_http_only */));
 
   if (TypeParam::supports_http_only) {
     // Permission to modify http only cookies is required to create an
@@ -603,7 +603,7 @@
                 "G", "H", http_foo_host, "/unique", base::Time(), base::Time(),
                 base::Time(), false /* secure */, true /* httponly */,
                 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-            "http", false /* modify_http_only */));
+            false /* secure_source */, false /* modify_http_only */));
 
     // Permission to modify httponly cookies is also required to overwrite
     // an httponly cookie.
@@ -613,7 +613,7 @@
             "G", "H", http_foo_host, "/unique", base::Time(), base::Time(),
             base::Time(), false /* secure */, true /* httponly */,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /* modify_http_only */));
+        false /* secure_source */, true /* modify_http_only */));
 
     EXPECT_EQ(
         CanonicalCookie::CookieInclusionStatus::EXCLUDE_HTTP_ONLY,
@@ -623,7 +623,7 @@
                 "G", "H", http_foo_host, "/unique", base::Time(), base::Time(),
                 base::Time(), false /* secure */, true /* httponly */,
                 CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-            "http", false /* modify_http_only */));
+            false /* secure_source */, false /* modify_http_only */));
   } else {
     // Leave store in same state as if the above tests had been run.
     EXPECT_TRUE(this->SetCanonicalCookie(
@@ -632,7 +632,7 @@
             "G", "H", http_foo_host, "/unique", base::Time(), base::Time(),
             base::Time(), false /* secure */, true /* httponly */,
             CookieSameSite::DEFAULT_MODE, COOKIE_PRIORITY_DEFAULT),
-        "http", true /* modify_http_only */));
+        false /* secure_source */, true /* modify_http_only */));
   }
 
   // Get all the cookies for a given URL, regardless of properties. This 'get()'
@@ -719,28 +719,28 @@
           "A", "B", http_domain, "/", base::Time::Now(), base::Time(),
           base::Time(), true, false, CookieSameSite::NO_RESTRICTION,
           COOKIE_PRIORITY_DEFAULT),
-      "http", true /*modify_httponly*/));
+      false /*secure_source*/, true /*modify_httponly*/));
   EXPECT_TRUE(this->SetCanonicalCookie(
       cs,
       std::make_unique<CanonicalCookie>(
           "A", "B", http_domain, "/", base::Time::Now(), base::Time(),
           base::Time(), true, false, CookieSameSite::NO_RESTRICTION,
           COOKIE_PRIORITY_DEFAULT),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
   EXPECT_TRUE(this->SetCanonicalCookie(
       cs,
       std::make_unique<CanonicalCookie>(
           "A", "B", http_domain, "/", base::Time::Now(), base::Time(),
           base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
           COOKIE_PRIORITY_DEFAULT),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
   EXPECT_TRUE(this->SetCanonicalCookie(
       cs,
       std::make_unique<CanonicalCookie>(
           "A", "B", http_domain, "/", base::Time::Now(), base::Time(),
           base::Time(), false, false, CookieSameSite::NO_RESTRICTION,
           COOKIE_PRIORITY_DEFAULT),
-      "http", true /*modify_httponly*/));
+      false /*secure_source*/, true /*modify_httponly*/));
 }
 
 // The iOS networking stack uses the iOS cookie parser, which we do not
diff --git a/services/network/cookie_manager.cc b/services/network/cookie_manager.cc
index cbc745a..5565df5 100644
--- a/services/network/cookie_manager.cc
+++ b/services/network/cookie_manager.cc
@@ -135,11 +135,11 @@
 }
 
 void CookieManager::SetCanonicalCookie(const net::CanonicalCookie& cookie,
-                                       const std::string& source_scheme,
+                                       bool secure_source,
                                        bool modify_http_only,
                                        SetCanonicalCookieCallback callback) {
   cookie_store_->SetCanonicalCookieAsync(
-      std::make_unique<net::CanonicalCookie>(cookie), source_scheme,
+      std::make_unique<net::CanonicalCookie>(cookie), secure_source,
       modify_http_only, StatusToBool(std::move(callback)));
 }
 
diff --git a/services/network/cookie_manager.h b/services/network/cookie_manager.h
index aac75b5..d08f3c5 100644
--- a/services/network/cookie_manager.h
+++ b/services/network/cookie_manager.h
@@ -62,7 +62,7 @@
                      const net::CookieOptions& cookie_options,
                      GetCookieListCallback callback) override;
   void SetCanonicalCookie(const net::CanonicalCookie& cookie,
-                          const std::string& source_scheme,
+                          bool secure_source,
                           bool modify_http_only,
                           SetCanonicalCookieCallback callback) override;
   void DeleteCanonicalCookie(const net::CanonicalCookie& cookie,
diff --git a/services/network/cookie_manager_unittest.cc b/services/network/cookie_manager_unittest.cc
index 0647cf1..848122d5 100644
--- a/services/network/cookie_manager_unittest.cc
+++ b/services/network/cookie_manager_unittest.cc
@@ -92,12 +92,12 @@
   }
 
   bool SetCanonicalCookie(const net::CanonicalCookie& cookie,
-                          std::string source_scheme,
+                          bool secure_source,
                           bool modify_http_only) {
     base::RunLoop run_loop;
     bool result = false;
     cookie_service_->SetCanonicalCookie(
-        cookie, std::move(source_scheme), modify_http_only,
+        cookie, secure_source, modify_http_only,
         base::BindOnce(&SynchronousCookieManager::SetCookieCallback, &run_loop,
                        &result));
     run_loop.Run();
@@ -181,13 +181,13 @@
 
   // Set a canonical cookie directly into the store.
   bool SetCanonicalCookie(const net::CanonicalCookie& cookie,
-                          std::string source_scheme,
+                          bool secure_source,
                           bool can_modify_httponly) {
     net::ResultSavingCookieCallback<net::CanonicalCookie::CookieInclusionStatus>
         callback;
     cookie_monster_->SetCanonicalCookieAsync(
-        std::make_unique<net::CanonicalCookie>(cookie),
-        std::move(source_scheme), can_modify_httponly,
+        std::make_unique<net::CanonicalCookie>(cookie), secure_source,
+        can_modify_httponly,
         base::BindOnce(&net::ResultSavingCookieCallback<
                            net::CanonicalCookie::CookieInclusionStatus>::Run,
                        base::Unretained(&callback)));
@@ -289,27 +289,27 @@
                            /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "C", "D", "foo_host2", "/with/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "Secure", "E", kCookieDomain, "/with/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/true,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "HttpOnly", "F", kCookieDomain, "/with/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   base::Time after_creation(base::Time::Now());
 
@@ -384,27 +384,27 @@
                            /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "C", "D", "foo_host2", "/with/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "Secure", "E", kCookieDomain, "/with/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/true,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "HttpOnly", "F", kCookieDomain, "/with/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   std::vector<net::CanonicalCookie> cookies = service_wrapper()->GetCookieList(
       GURL("https://foo_host.com/with/path"), net::CookieOptions());
@@ -428,7 +428,7 @@
                            /*secure=*/false, /*httponly=*/true,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
   ASSERT_TRUE(result);
   result = SetCanonicalCookie(
       net::CanonicalCookie("C", "D", kCookieDomain, "/", base::Time(),
@@ -436,7 +436,7 @@
                            /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
   ASSERT_TRUE(result);
 
   // Retrieve without httponly cookies (default)
@@ -467,21 +467,21 @@
                            /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
   ASSERT_TRUE(result);
   result = SetCanonicalCookie(
       net::CanonicalCookie("C", "D", kCookieDomain, "/", base::Time(),
                            base::Time(), base::Time(), /*secure=*/false,
                            /*httponly=*/false, net::CookieSameSite::LAX_MODE,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
   ASSERT_TRUE(result);
   result = SetCanonicalCookie(
       net::CanonicalCookie("E", "F", kCookieDomain, "/", base::Time(),
                            base::Time(), base::Time(), /*secure=*/false,
                            /*httponly=*/false, net::CookieSameSite::STRICT_MODE,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
   ASSERT_TRUE(result);
 
   // Retrieve only unrestricted cookies.
@@ -522,7 +522,7 @@
                            /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
   ASSERT_TRUE(result);
 
   // Get the cookie without updating the access time and check
@@ -554,7 +554,7 @@
           "A", "B", "foo_host", "/", base::Time(), base::Time(), base::Time(),
           /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   std::vector<net::CanonicalCookie> cookies =
       service_wrapper()->GetAllCookies();
   ASSERT_EQ(1U, cookies.size());
@@ -570,27 +570,27 @@
                            /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "C", "D", "foo_host2", "/with/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "Secure", "E", kCookieDomain, "/with/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/true,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "HttpOnly", "F", kCookieDomain, "/with/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   base::Time yesterday = base::Time::Now() - base::TimeDelta::FromDays(1);
   EXPECT_TRUE(service_wrapper()->SetCanonicalCookie(
@@ -598,7 +598,7 @@
           "A", "E", kCookieDomain, "/", base::Time(), yesterday, base::Time(),
           /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "http", false));
+      false, false));
 
   std::vector<net::CanonicalCookie> cookies =
       service_wrapper()->GetAllCookies();
@@ -623,7 +623,7 @@
                            /*secure=*/true, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "http", false));
+      false, false));
   std::vector<net::CanonicalCookie> cookies =
       service_wrapper()->GetAllCookies();
 
@@ -637,7 +637,7 @@
                            /*secure=*/false, /*httponly=*/true,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "http", false));
+      false, false));
   std::vector<net::CanonicalCookie> cookies =
       service_wrapper()->GetAllCookies();
 
@@ -651,7 +651,7 @@
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_FALSE(service_wrapper()->SetCanonicalCookie(
       net::CanonicalCookie(
@@ -659,7 +659,7 @@
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "http", false));
+      false, false));
 
   std::vector<net::CanonicalCookie> cookies =
       service_wrapper()->GetAllCookies();
@@ -677,27 +677,27 @@
                            /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "C", "D", "foo_host2", "/with/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "Secure", "E", kCookieDomain, "/with/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/true,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "HttpOnly", "F", kCookieDomain, "/with/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/true, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   EXPECT_EQ(4u, service_wrapper()->DeleteCookies(filter));
@@ -717,7 +717,7 @@
                            base::Time(), /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
@@ -725,7 +725,7 @@
           now - base::TimeDelta::FromMinutes(120), base::Time(), base::Time(),
           /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
@@ -733,7 +733,7 @@
           now - base::TimeDelta::FromMinutes(180), base::Time(), base::Time(),
           /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   filter.created_after_time = now - base::TimeDelta::FromMinutes(150);
@@ -754,21 +754,21 @@
           "A1", "val", "foo_host1", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A2", "val", "foo_host2", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", "foo_host3", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   filter.excluding_domains = std::vector<std::string>();
@@ -787,21 +787,21 @@
           "A1", "val", "foo_host1", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A2", "val", "foo_host2", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", "foo_host3", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   filter.including_domains = std::vector<std::string>();
@@ -822,19 +822,19 @@
           "A1", "val", "example.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A2", "val", "www.example.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", "www.nonexample.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   filter.including_domains = std::vector<std::string>();
@@ -853,19 +853,19 @@
           "A1", "val", "example.co.uk", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A2", "val", "www.example.co.uk", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", "www.nonexample.co.uk", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   filter.including_domains = std::vector<std::string>();
   filter.including_domains->push_back("example.co.uk");
   EXPECT_EQ(2u, service_wrapper()->DeleteCookies(filter));
@@ -882,19 +882,19 @@
           "A1", "val", "example.co.uk", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A2", "val", "www.example.co.uk", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", "www.nonexample.co.uk", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   filter.including_domains = std::vector<std::string>();
   filter.including_domains->push_back("co.uk");
   EXPECT_EQ(0u, service_wrapper()->DeleteCookies(filter));
@@ -915,25 +915,25 @@
           "A1", "val", "foo_host.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A2", "val", ".foo_host.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", "bar.host.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A4", "val", ".bar.host.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   filter.including_domains = std::vector<std::string>();
@@ -953,31 +953,31 @@
           "A1", "val", "random.co.uk", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A2", "val", "sub.domain.random.co.uk", "/", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", "random.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A4", "val", "random", "/", base::Time(), base::Time(), base::Time(),
           /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A5", "val", "normal.co.uk", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   filter.including_domains = std::vector<std::string>();
@@ -998,7 +998,7 @@
           "A1", "val", "privatedomain", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
@@ -1007,7 +1007,7 @@
           "A2", "val", "privatedomain.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
@@ -1016,7 +1016,7 @@
           "A3", "val", "subdomain.privatedomain", "/", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   filter.including_domains = std::vector<std::string>();
@@ -1050,13 +1050,13 @@
           "A01", "RandomValue", "example.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A02", "RandomValue", "canonical.com", "/", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Path
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1064,13 +1064,13 @@
           "A03", "val", "example.com", "/this/is/a/long/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A04", "val", "canonical.com", "/this/is/a/long/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Last_access
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1080,7 +1080,7 @@
           base::Time::Now() - base::TimeDelta::FromDays(3), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A06", "val", "canonical.com", "/",
@@ -1088,7 +1088,7 @@
           base::Time::Now() - base::TimeDelta::FromDays(3), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Same_site
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1096,13 +1096,13 @@
                            base::Time(), base::Time(), /*secure=*/false,
                            /*httponly=*/false, net::CookieSameSite::STRICT_MODE,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie("A08", "val", "canonical.com", "/", base::Time(),
                            base::Time(), base::Time(), /*secure=*/false,
                            /*httponly=*/false, net::CookieSameSite::STRICT_MODE,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Priority
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1110,13 +1110,13 @@
           "A09", "val", "example.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_HIGH),
-      "https", true));
+      true, true));
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A10", "val", "canonical.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_HIGH),
-      "https", true));
+      true, true));
 
   // Use the filter and make sure the result is the expected set.
   EXPECT_EQ(5u, service_wrapper()->DeleteCookies(filter));
@@ -1210,7 +1210,7 @@
             "A1", "val", test_cases[i].domain, test_cases[i].path, base::Time(),
             base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
             net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-        "https", true));
+        true, true));
 
     if (!exclude_domain_cookie) {
       // Host cookie
@@ -1220,7 +1220,7 @@
               base::Time(), base::Time(), base::Time(), /*secure=*/false,
               /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
               net::COOKIE_PRIORITY_MEDIUM),
-          "https", true));
+          true, true));
     }
 
     // Httponly cookie
@@ -1229,7 +1229,7 @@
             "A3", "val", test_cases[i].domain, test_cases[i].path, base::Time(),
             base::Time(), base::Time(), /*secure=*/false, /*httponly=*/true,
             net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-        "https", true));
+        true, true));
 
     // Httponly and secure cookie
     EXPECT_TRUE(SetCanonicalCookie(
@@ -1237,7 +1237,7 @@
             "A4", "val", test_cases[i].domain, test_cases[i].path, base::Time(),
             base::Time(), base::Time(), /*secure=*/false, /*httponly=*/true,
             net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-        "https", true));
+        true, true));
 
     const uint32_t number_cookies = exclude_domain_cookie ? 3u : 4u;
     EXPECT_EQ(number_cookies, service_wrapper()->GetAllCookies().size());
@@ -1258,28 +1258,28 @@
           "A1", "val", kCookieDomain, "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A1", "val", "bar_host", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A2", "val", kCookieDomain, "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", "bar_host", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   mojom::CookieDeletionFilter filter;
   filter.cookie_name = std::string("A1");
@@ -1302,7 +1302,7 @@
           "A01", "val", "www.example.com", "/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/true, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that should not be deleted because it's a host cookie in a
   // subdomain that doesn't exactly match the passed URL.
@@ -1311,7 +1311,7 @@
           "A02", "val", "sub.www.example.com", "/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that shouldn't be deleted because the path doesn't match.
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1319,7 +1319,7 @@
           "A03", "val", "www.example.com", "/otherpath", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that shouldn't be deleted because the path is more specific
   // than the URL.
@@ -1328,7 +1328,7 @@
           "A04", "val", "www.example.com", "/path/path2", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that shouldn't be deleted because it's at a host cookie domain that
   // doesn't exactly match the url's host.
@@ -1337,7 +1337,7 @@
           "A05", "val", "example.com", "/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that should not be deleted because it's not a host cookie and
   // has a domain that's more specific than the URL
@@ -1346,7 +1346,7 @@
           "A06", "val", ".sub.www.example.com", "/path", base::Time(),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that should be deleted because it's not a host cookie and has a
   // domain that matches the URL
@@ -1355,7 +1355,7 @@
           "A07", "val", ".www.example.com", "/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that should be deleted because it's not a host cookie and has a
   // domain that domain matches the URL.
@@ -1364,7 +1364,7 @@
           "A08", "val", ".example.com", "/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that should be deleted because it matches exactly.
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1372,7 +1372,7 @@
           "A09", "val", "www.example.com", "/path", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   // Cookie that should be deleted because it applies to a larger set
   // of paths than the URL path.
@@ -1381,7 +1381,7 @@
           "A10", "val", "www.example.com", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true /*modify_httponly*/));
+      true /*secure_source*/, true /*modify_httponly*/));
 
   mojom::CookieDeletionFilter filter;
   filter.url = filter_url;
@@ -1408,7 +1408,7 @@
           "A1", "val", kCookieDomain, "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie("A2", "val", kCookieDomain, "/", base::Time(),
@@ -1416,14 +1416,14 @@
                            /*secure=*/false, /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_TRUE(SetCanonicalCookie(
       net::CanonicalCookie(
           "A3", "val", kCookieDomain, "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   mojom::CookieDeletionFilter filter;
   filter.session_control =
@@ -1476,7 +1476,7 @@
           now + base::TimeDelta::FromDays(3), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Too old cookie.
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1485,7 +1485,7 @@
           now + base::TimeDelta::FromDays(3), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Too young cookie.
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1494,7 +1494,7 @@
           now + base::TimeDelta::FromDays(3), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Not in domains_and_ips_to_delete.
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1504,7 +1504,7 @@
           now + base::TimeDelta::FromDays(3), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // In domains_and_ips_to_ignore.
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1513,7 +1513,7 @@
           now + base::TimeDelta::FromDays(3), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Doesn't match URL (by path).
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1523,7 +1523,7 @@
           now + base::TimeDelta::FromDays(3), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   // Session
   EXPECT_TRUE(SetCanonicalCookie(
@@ -1531,7 +1531,7 @@
           "A7", "val7", "nope.com", "/path", now - base::TimeDelta::FromDays(3),
           base::Time(), base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   EXPECT_EQ(1u, service_wrapper()->DeleteCookies(filter));
   std::vector<net::CanonicalCookie> cookies =
@@ -1619,7 +1619,7 @@
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
   base::RunLoop().RunUntilIdle();
   EXPECT_EQ(0u, listener.observed_changes().size());
 
@@ -1631,7 +1631,7 @@
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
 
   base::RunLoop().RunUntilIdle();
   EXPECT_EQ(0u, listener.observed_changes().size());
@@ -1643,7 +1643,7 @@
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
 
   // Expect asynchrony
   EXPECT_EQ(0u, listener.observed_changes().size());
@@ -1699,7 +1699,7 @@
                            /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
 
   // Expect asynchrony
   EXPECT_EQ(0u, listener.observed_changes().size());
@@ -1723,14 +1723,14 @@
                            /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
   service_wrapper()->SetCanonicalCookie(
       net::CanonicalCookie("Thing2", "val", kThatHost, "/", base::Time(),
                            base::Time(), base::Time(), /*secure=*/false,
                            /*httponly=*/false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
 
   base::RunLoop().RunUntilIdle();
   observed_changes = listener.observed_changes();
@@ -1788,7 +1788,7 @@
           base::Time(), base::Time(), /*secure=*/false,
           /*httponly=*/false, net::CookieSameSite::NO_RESTRICTION,
           net::COOKIE_PRIORITY_MEDIUM),
-      "https", true);
+      true, true);
 
   EXPECT_EQ(0u, listener1->observed_changes().size());
   EXPECT_EQ(0u, listener2->observed_changes().size());
@@ -1840,7 +1840,7 @@
           "X", "Y", "www.other.host", "/", base::Time(), base::Time(),
           base::Time(), /*secure=*/false, /*httponly=*/false,
           net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_MEDIUM),
-      "https", true));
+      true, true));
 
   std::vector<net::CanonicalCookie> cookies = service_wrapper()->GetCookieList(
       GURL("http://www.other.host/"), net::CookieOptions());
@@ -2015,7 +2015,7 @@
 };
 
 TEST_F(SessionCleanupCookieManagerTest, PersistSessionCookies) {
-  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), "https", true));
+  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), true, true));
 
   EXPECT_EQ(1u, service_wrapper()->GetAllCookies().size());
 
@@ -2027,7 +2027,7 @@
 }
 
 TEST_F(SessionCleanupCookieManagerTest, DeleteSessionCookies) {
-  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), "https", true));
+  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), true, true));
 
   EXPECT_EQ(1u, service_wrapper()->GetAllCookies().size());
 
@@ -2042,7 +2042,7 @@
 }
 
 TEST_F(SessionCleanupCookieManagerTest, SettingMustMatchDomain) {
-  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), "https", true));
+  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), true, true));
 
   EXPECT_EQ(1u, service_wrapper()->GetAllCookies().size());
 
@@ -2057,7 +2057,7 @@
 }
 
 TEST_F(SessionCleanupCookieManagerTest, FirstSettingTakesPrecedence) {
-  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), "https", true));
+  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), true, true));
 
   EXPECT_EQ(1u, service_wrapper()->GetAllCookies().size());
 
@@ -2075,7 +2075,7 @@
 }
 
 TEST_F(SessionCleanupCookieManagerTest, ForceKeepSessionState) {
-  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), "https", true));
+  EXPECT_TRUE(SetCanonicalCookie(CreateCookie(), true, true));
 
   EXPECT_EQ(1u, service_wrapper()->GetAllCookies().size());
 
@@ -2092,7 +2092,7 @@
 
 TEST_F(SessionCleanupCookieManagerTest, HttpCookieAllowedOnHttps) {
   EXPECT_TRUE(SetCanonicalCookie(CreateCookie(StrCat({"www.", kCookieDomain})),
-                                 "https", true));
+                                 true, true));
 
   EXPECT_EQ(1u, service_wrapper()->GetAllCookies().size());
 
diff --git a/services/network/network_context_unittest.cc b/services/network/network_context_unittest.cc
index 352faef..b0c52273 100644
--- a/services/network/network_context_unittest.cc
+++ b/services/network/network_context_unittest.cc
@@ -2037,7 +2037,7 @@
                            base::Time(), base::Time(), false, false,
                            net::CookieSameSite::NO_RESTRICTION,
                            net::COOKIE_PRIORITY_LOW),
-      "https", true, base::BindOnce(&SetCookieCallback, &run_loop1, &result));
+      true, true, base::BindOnce(&SetCookieCallback, &run_loop1, &result));
   run_loop1.Run();
   EXPECT_TRUE(result);
 
diff --git a/services/network/public/mojom/cookie_manager.mojom b/services/network/public/mojom/cookie_manager.mojom
index 9afd983..d991ce8 100644
--- a/services/network/public/mojom/cookie_manager.mojom
+++ b/services/network/public/mojom/cookie_manager.mojom
@@ -181,13 +181,12 @@
   GetCookieList(url.mojom.Url url, CookieOptions cookie_options) =>
       (array<CanonicalCookie> cookies);
 
-  // Set a cookie.  |source_scheme| is used to check whether existing secure
+  // Set a cookie.  |secure_source| indicates whether existing secure
   // cookies can be overwritten (secure cookies may be created from a
-  // non-secure source), and whether the scheme is permitted to use cookies in
-  // the first place.  |modify_http_only| indicates whether http_only
+  // non-secure source).  |modify_http_only| indicates whether http_only
   // cookies may be overwritten.
   SetCanonicalCookie(
-      CanonicalCookie cookie, string source_scheme, bool modify_http_only) =>
+      CanonicalCookie cookie, bool secure_source, bool modify_http_only) =>
       (bool success);
 
   // Delete a cookie. Returns true if a cookie was deleted.
diff --git a/services/network/restricted_cookie_manager.cc b/services/network/restricted_cookie_manager.cc
index a6e5a1e..e6ddf37 100644
--- a/services/network/restricted_cookie_manager.cc
+++ b/services/network/restricted_cookie_manager.cc
@@ -219,10 +219,12 @@
       cookie.ExpiryDate(), now, cookie.IsSecure(), cookie.IsHttpOnly(),
       cookie.SameSite(), cookie.Priority());
 
-  // TODO(pwnall): source_scheme might depend on the renderer.
+  // TODO(pwnall): secure_source should depend on url, and might depend on the
+  //               renderer.
+  bool secure_source = true;
   bool modify_http_only = false;
   cookie_store_->SetCanonicalCookieAsync(std::move(sanitized_cookie),
-                                         origin_.scheme(), modify_http_only,
+                                         secure_source, modify_http_only,
                                          StatusToBool(std::move(callback)));
 }
 
diff --git a/services/network/restricted_cookie_manager_unittest.cc b/services/network/restricted_cookie_manager_unittest.cc
index 293b14a..c20e8f2 100644
--- a/services/network/restricted_cookie_manager_unittest.cc
+++ b/services/network/restricted_cookie_manager_unittest.cc
@@ -105,13 +105,13 @@
 
   // Set a canonical cookie directly into the store.
   bool SetCanonicalCookie(const net::CanonicalCookie& cookie,
-                          std::string source_scheme,
+                          bool secure_source,
                           bool can_modify_httponly) {
     net::ResultSavingCookieCallback<net::CanonicalCookie::CookieInclusionStatus>
         callback;
     cookie_monster_.SetCanonicalCookieAsync(
-        std::make_unique<net::CanonicalCookie>(cookie),
-        std::move(source_scheme), can_modify_httponly,
+        std::make_unique<net::CanonicalCookie>(cookie), secure_source,
+        can_modify_httponly,
         base::BindOnce(&net::ResultSavingCookieCallback<
                            net::CanonicalCookie::CookieInclusionStatus>::Run,
                        base::Unretained(&callback)));
@@ -134,7 +134,7 @@
                              /* httponly = */ false,
                              net::CookieSameSite::NO_RESTRICTION,
                              net::COOKIE_PRIORITY_DEFAULT),
-        "https", /* can_modify_httponly = */ true));
+        /* secure_source = */ true, /* can_modify_httponly = */ true));
   }
 
   void ExpectBadMessage() { expecting_bad_message_ = true; }
diff --git a/services/network/test/test_cookie_manager.cc b/services/network/test/test_cookie_manager.cc
index 1654025..782c596 100644
--- a/services/network/test/test_cookie_manager.cc
+++ b/services/network/test/test_cookie_manager.cc
@@ -14,7 +14,7 @@
 
 void TestCookieManager::SetCanonicalCookie(
     const net::CanonicalCookie& cookie,
-    const std::string& source_scheme,
+    bool secure_source,
     bool modify_http_only,
     SetCanonicalCookieCallback callback) {
   std::move(callback).Run(false);
diff --git a/services/network/test/test_cookie_manager.h b/services/network/test/test_cookie_manager.h
index cce528a..8d5bc4d 100644
--- a/services/network/test/test_cookie_manager.h
+++ b/services/network/test/test_cookie_manager.h
@@ -22,7 +22,7 @@
   ~TestCookieManager() override;
 
   void SetCanonicalCookie(const net::CanonicalCookie& cookie,
-                          const std::string& source_scheme,
+                          bool secure_source,
                           bool modify_http_only,
                           SetCanonicalCookieCallback callback) override;
   void GetAllCookies(GetAllCookiesCallback callback) override {}
diff --git a/url/gurl.cc b/url/gurl.cc
index 84e7bf1..4cecabc 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -372,20 +372,6 @@
   return SchemeIs(url::kWsScheme) || SchemeIs(url::kWssScheme);
 }
 
-bool GURL::SchemeIsCryptographic() const {
-  if (parsed_.scheme.len <= 0)
-    return false;
-  return SchemeIsCryptographic(scheme_piece());
-}
-
-bool GURL::SchemeIsCryptographic(base::StringPiece lower_ascii_scheme) {
-  DCHECK(base::IsStringASCII(lower_ascii_scheme));
-  DCHECK(base::ToLowerASCII(lower_ascii_scheme) == lower_ascii_scheme);
-
-  return lower_ascii_scheme == url::kHttpsScheme ||
-         lower_ascii_scheme == url::kWssScheme;
-}
-
 int GURL::IntPort() const {
   if (parsed_.port.is_nonempty())
     return url::ParsePort(spec_.data(), parsed_.port);
diff --git a/url/gurl.h b/url/gurl.h
index 1b0669e..5bfa17f 100644
--- a/url/gurl.h
+++ b/url/gurl.h
@@ -249,10 +249,9 @@
   // is minimally trustworthy. For that, see Chromium's |IsOriginSecure| for a
   // higher-level and more complete semantics. See that function's documentation
   // for more detail.
-  bool SchemeIsCryptographic() const;
-
-  // As above, but static. Parameter should be lower-case ASCII.
-  static bool SchemeIsCryptographic(base::StringPiece lower_ascii_scheme);
+  bool SchemeIsCryptographic() const {
+    return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme);
+  }
 
   // Returns true if the scheme is "blob".
   bool SchemeIsBlob() const {
diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc
index 379c04f..caf5dd4 100644
--- a/url/gurl_unittest.cc
+++ b/url/gurl_unittest.cc
@@ -765,14 +765,6 @@
   EXPECT_FALSE(GURL("ws://foo.bar.com/").SchemeIsCryptographic());
 }
 
-TEST(GURLTest, SchemeIsCryptographicStatic) {
-  EXPECT_TRUE(GURL::SchemeIsCryptographic("https"));
-  EXPECT_TRUE(GURL::SchemeIsCryptographic("wss"));
-  EXPECT_FALSE(GURL::SchemeIsCryptographic("http"));
-  EXPECT_FALSE(GURL::SchemeIsCryptographic("ws"));
-  EXPECT_FALSE(GURL::SchemeIsCryptographic("ftp"));
-}
-
 TEST(GURLTest, SchemeIsBlob) {
   EXPECT_TRUE(GURL("BLOB://BAR/").SchemeIsBlob());
   EXPECT_TRUE(GURL("blob://bar/").SchemeIsBlob());