diff options
Diffstat (limited to 'chromium/components/safe_browsing/content/browser/safe_browsing_network_context.cc')
-rw-r--r-- | chromium/components/safe_browsing/content/browser/safe_browsing_network_context.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chromium/components/safe_browsing/content/browser/safe_browsing_network_context.cc b/chromium/components/safe_browsing/content/browser/safe_browsing_network_context.cc index 43daf77b1c4..d54a8f6f932 100644 --- a/chromium/components/safe_browsing/content/browser/safe_browsing_network_context.cc +++ b/chromium/components/safe_browsing/content/browser/safe_browsing_network_context.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/files/file_util.h" +#include "base/trace_event/trace_event.h" #include "components/safe_browsing/core/common/safebrowsing_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/network_context_client_base.h" @@ -21,6 +22,10 @@ #include "services/network/network_context.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" +#if BUILDFLAG(IS_ANDROID) +#include "base/android/remove_stale_data.h" +#endif + namespace safe_browsing { class SafeBrowsingNetworkContext::SharedURLLoaderFactory @@ -115,6 +120,8 @@ class SafeBrowsingNetworkContext::SharedURLLoaderFactory ~SharedURLLoaderFactory() override = default; network::mojom::NetworkContextParamsPtr CreateNetworkContextParams() { + TRACE_EVENT0("startup", + "SafeBrowsingNetworkContext::CreateNetworkContextParams"); DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); network::mojom::NetworkContextParamsPtr network_context_params = network_context_params_factory_.Run(); @@ -132,6 +139,18 @@ class SafeBrowsingNetworkContext::SharedURLLoaderFactory base::FilePath::StringType(kSafeBrowsingBaseFilename) + kCookiesFile); network_context_params->enable_encrypted_cookies = false; +#if BUILDFLAG(IS_ANDROID) + // On Android the `data_directory` was used by some wrong builds instead of + // `unsandboxed_data_path`. Cleaning it up. See crbug.com/1331809. + // The `cookie_manager` is set by WebView, where the mistaken migration did + // not happen. + DCHECK(!trigger_migration_); + if (!network_context_params->cookie_manager) { + base::android::RemoveStaleDataDirectory( + network_context_params->file_paths->data_directory.path()); + } +#endif // BUILDFLAG(IS_ANDROID) + return network_context_params; } |