// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/appcache/appcache_host.h" #include #include #include "base/check_op.h" #include "base/debug/dump_without_crashing.h" #include "base/memory/ptr_util.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "content/browser/appcache/appcache.h" #include "content/browser/appcache/appcache_backend_impl.h" #include "content/browser/appcache/appcache_policy.h" #include "content/browser/appcache/appcache_request.h" #include "content/browser/appcache/appcache_request_handler.h" #include "content/browser/appcache/appcache_subresource_url_factory.h" #include "content/browser/child_process_security_policy_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/appcache_interfaces.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_client.h" #include "content/public/common/url_constants.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "storage/browser/quota/quota_manager_proxy.h" #include "third_party/blink/public/mojom/appcache/appcache.mojom.h" #include "third_party/blink/public/mojom/appcache/appcache_info.mojom.h" namespace content { namespace { blink::mojom::AppCacheInfoPtr CreateCacheInfo( const AppCache* cache, const GURL& manifest_url, blink::mojom::AppCacheStatus status) { auto info = blink::mojom::AppCacheInfo::New(); info->manifest_url = manifest_url; info->status = status; if (!cache) return info; info->cache_id = cache->cache_id(); if (!cache->is_complete()) return info; DCHECK(cache->owning_group()); info->is_complete = true; info->group_id = cache->owning_group()->group_id(); info->last_update_time = cache->update_time(); info->creation_time = cache->owning_group()->creation_time(); info->response_sizes = cache->cache_size(); info->padding_sizes = cache->padding_size(); return info; } bool CanAccessDocumentURL(ChildProcessSecurityPolicyImpl::Handle* handle, const GURL& document_url) { DCHECK(handle->is_valid()); return document_url.is_empty() || // window.open("javascript:''") case. document_url.IsAboutSrcdoc() || //