#include "chrome/browser/safe_browsing/download_protection/ppapi_download_request.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/escape.h"
#include "base/task/bind_post_task.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
#include "components/safe_browsing/content/common/file_type_policies.h"
#include "components/safe_browsing/core/browser/db/database_manager.h"
#include "components/safe_browsing/core/common/features.h"
#include "components/safe_browsing/core/common/utils.h"
#include "components/sessions/content/session_tab_helper.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/web_contents.h"
#include "google_apis/google_api_keys.h"
#include "net/base/load_flags.h"
#include "net/http/http_cache.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
BrowserThread;
namespace safe_browsing {
const char PPAPIDownloadRequest::kDownloadRequestUrl[] = …;
PPAPIDownloadRequest::PPAPIDownloadRequest(
const GURL& requestor_url,
content::RenderFrameHost* initiating_frame,
const base::FilePath& default_file_path,
const std::vector<base::FilePath::StringType>& alternate_extensions,
Profile* profile,
CheckDownloadCallback callback,
DownloadProtectionService* service,
scoped_refptr<SafeBrowsingDatabaseManager> database_manager)
: … { … }
PPAPIDownloadRequest::~PPAPIDownloadRequest() { … }
void PPAPIDownloadRequest::Start() { … }
GURL PPAPIDownloadRequest::GetDownloadRequestUrl() { … }
void PPAPIDownloadRequest::WebContentsDestroyed() { … }
void PPAPIDownloadRequest::CheckAllowlistsOnUIThread(
const GURL& requestor_url,
scoped_refptr<SafeBrowsingDatabaseManager> database_manager,
base::WeakPtr<PPAPIDownloadRequest> download_request) { … }
void PPAPIDownloadRequest::AllowlistCheckComplete(bool was_on_allowlist) { … }
void PPAPIDownloadRequest::SendRequest() { … }
void PPAPIDownloadRequest::OnURLLoaderComplete(
std::unique_ptr<std::string> response_body) { … }
void PPAPIDownloadRequest::OnRequestTimedOut() { … }
void PPAPIDownloadRequest::Finish(RequestOutcome reason,
DownloadCheckResult response) { … }
DownloadCheckResult
PPAPIDownloadRequest::DownloadCheckResultFromClientDownloadResponse(
ClientDownloadResponse::Verdict verdict) { … }
base::FilePath PPAPIDownloadRequest::GetSupportedFilePath(
const base::FilePath& default_file_path,
const std::vector<base::FilePath::StringType>& alternate_extensions) { … }
}