summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-11 10:09:26 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-11 10:09:26 +0000
commitcc650f70f105fe518420b6c2153f679bae865a07 (patch)
treed4f8c6f44d7d1cc4aedcb6d28894bde3ab5ad53a /chrome/browser/safe_browsing
parente264dbeaab83079ecd318d064bcf12270c558b78 (diff)
downloadchromium_src-cc650f70f105fe518420b6c2153f679bae865a07.zip
chromium_src-cc650f70f105fe518420b6c2153f679bae865a07.tar.gz
chromium_src-cc650f70f105fe518420b6c2153f679bae865a07.tar.bz2
Remove PlatformFile from safe browsing.
BUG=322664 R=mattm@chromium.org Review URL: https://codereview.chromium.org/180213009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256178 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r--chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc18
-rw-r--r--chrome/browser/safe_browsing/sandboxed_zip_analyzer.h6
2 files changed, 9 insertions, 15 deletions
diff --git a/chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc b/chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc
index 5d3c512..7e11419 100644
--- a/chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc
+++ b/chrome/browser/safe_browsing/sandboxed_zip_analyzer.cc
@@ -26,7 +26,7 @@ namespace safe_browsing {
SandboxedZipAnalyzer::SandboxedZipAnalyzer(
const base::FilePath& zip_file,
const ResultCallback& result_callback)
- : zip_file_(zip_file),
+ : zip_file_name_(zip_file),
callback_(result_callback),
callback_called_(false) {
}
@@ -49,13 +49,10 @@ SandboxedZipAnalyzer::~SandboxedZipAnalyzer() {
}
void SandboxedZipAnalyzer::AnalyzeInSandbox() {
- zip_platform_file_ = base::CreatePlatformFile(
- zip_file_,
- base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
- NULL, // created
- NULL); // error_code
- if (zip_platform_file_ == base::kInvalidPlatformFileValue) {
- VLOG(1) << "Could not open zip file: " << zip_file_.value();
+ zip_file_.Initialize(zip_file_name_,
+ base::File::FLAG_OPEN | base::File::FLAG_READ);
+ if (!zip_file_.IsValid()) {
+ VLOG(1) << "Could not open zip file: " << zip_file_name_.value();
if (!BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&SandboxedZipAnalyzer::OnAnalyzeZipFileFinished, this,
@@ -118,10 +115,7 @@ void SandboxedZipAnalyzer::OnUtilityProcessStarted() {
}
utility_process_host_->Send(
new ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection(
- IPC::GetFileHandleForProcess(
- zip_platform_file_,
- utility_process,
- true /* close_source_handle */)));
+ IPC::TakeFileHandleForProcess(zip_file_.Pass(), utility_process)));
}
} // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/sandboxed_zip_analyzer.h b/chrome/browser/safe_browsing/sandboxed_zip_analyzer.h
index 81c1b90..e51e867 100644
--- a/chrome/browser/safe_browsing/sandboxed_zip_analyzer.h
+++ b/chrome/browser/safe_browsing/sandboxed_zip_analyzer.h
@@ -13,9 +13,9 @@
#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/memory/weak_ptr.h"
-#include "base/platform_file.h"
#include "content/public/browser/utility_process_host.h"
#include "content/public/browser/utility_process_host_client.h"
@@ -61,10 +61,10 @@ class SandboxedZipAnalyzer : public content::UtilityProcessHostClient {
// Launches the utility process. Must run on the IO thread.
void StartProcessOnIOThread();
- const base::FilePath zip_file_;
+ const base::FilePath zip_file_name_;
// Once we have opened the file, we store the handle so that we can use it
// once the utility process has launched.
- base::PlatformFile zip_platform_file_;
+ base::File zip_file_;
base::WeakPtr<content::UtilityProcessHost> utility_process_host_;
const ResultCallback callback_;
// Initialized on the UI thread, but only accessed on the IO thread.