| Index: chrome/browser/download/download_target_determiner_delegate.h
|
| diff --git a/chrome/browser/download/download_target_determiner_delegate.h b/chrome/browser/download/download_target_determiner_delegate.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1a99f42d575b467b0dc8b818e25574057c8076c5
|
| --- /dev/null
|
| +++ b/chrome/browser/download/download_target_determiner_delegate.h
|
| @@ -0,0 +1,70 @@
|
| +// Copyright 2013 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.
|
| +
|
| +#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_
|
| +#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_
|
| +
|
| +#include "base/callback_forward.h"
|
| +
|
| +class ExtensionDownloadsEventRouter;
|
| +
|
| +namespace base {
|
| +class FilePath;
|
| +}
|
| +
|
| +namespace content {
|
| +class DownloadItem;
|
| +}
|
| +
|
| +namespace safe_browsing {
|
| +class DownloadProtectionService;
|
| +}
|
| +
|
| +// Delegate for DownloadTargetDeterminer. The delegate isn't owned by
|
| +// DownloadTargetDeterminer and is expected to outlive it.
|
| +class DownloadTargetDeterminerDelegate {
|
| + public:
|
| + // Callback to be invoked when DetermineLocalPath() completes. The argument
|
| + // should be the determined local path. It should be non-empty on success. If
|
| + // |virtual_path| is already a local path, then |virtual_path| should be
|
| + // returned as-is.
|
| + typedef base::Callback<void(const base::FilePath&)> LocalPathCallback;
|
| +
|
| + // Callback to be invoked when ReserveVirtualPath() completes. If the path
|
| + // reservation is successful, then |successful| should be true and
|
| + // |reserved_path| should contain the reserved path. Otherwise, |successful|
|
| + // should be false. In the failure case, |reserved_path| is ignored.
|
| + typedef base::Callback<void(const base::FilePath& reserved_path,
|
| + bool successful)> ReservedPathCallback;
|
| +
|
| + // Returns the DownloadProtectionService to use for checking the download
|
| + // URL. If this returns NULL, the URL will not be checked.
|
| + virtual safe_browsing::DownloadProtectionService*
|
| + GetDownloadProtectionService() = 0;
|
| +
|
| + // If |virtual_path| is not a local path, should return a possibly temporary
|
| + // local path to use for storing the downloaded file. If |virtual_path| is
|
| + // already local, then it should return the same path. |callback| should be
|
| + // invoked to return the path.
|
| + virtual void DetermineLocalPath(content::DownloadItem* download,
|
| + const base::FilePath& virtual_path,
|
| + const LocalPathCallback& callback) = 0;
|
| +
|
| + // Reserve |virtual_path|. This is expected to check the following:
|
| + // - Whether |virtual_path| can be written to by the user. If not, the
|
| + // |virtual_path| can be changed to writeable path if necessary.
|
| + // - If |should_uniquify_path| is true, then |virtual_path| should be modified
|
| + // so that the new path is writeable and unique.
|
| + //
|
| + // |callback| should be invoked on completion with the results.
|
| + virtual void ReserveVirtualPath(content::DownloadItem* download,
|
| + const base::FilePath& virtual_path,
|
| + bool should_uniquify_path,
|
| + const ReservedPathCallback& callback) = 0;
|
| +
|
| + protected:
|
| + virtual ~DownloadTargetDeterminerDelegate();
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_DELEGATE_H_
|
|
|