blob: 4d892bdf143fa4346949270cd2ba43768d1bae8b [file] [log] [blame]
[email protected]84d57412012-03-03 08:59:551// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]98d6f152011-09-29 19:35:512// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_
6#define CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_
[email protected]98d6f152011-09-29 19:35:517
8#include "base/compiler_specific.h"
9#include "base/memory/ref_counted.h"
[email protected]1bd0ef12011-10-20 05:24:1710#include "content/public/browser/download_manager_delegate.h"
[email protected]98d6f152011-09-29 19:35:5111
[email protected]98d6f152011-09-29 19:35:5112namespace content {
13
[email protected]e582fdd2011-12-20 16:48:1714class DownloadManager;
15
[email protected]98d6f152011-09-29 19:35:5116class ShellDownloadManagerDelegate
17 : public DownloadManagerDelegate,
18 public base::RefCountedThreadSafe<ShellDownloadManagerDelegate> {
19 public:
20 ShellDownloadManagerDelegate();
21
[email protected]9bb54ee2011-10-12 17:43:3522 void SetDownloadManager(DownloadManager* manager);
[email protected]98d6f152011-09-29 19:35:5123
[email protected]854e1312012-07-30 17:26:3024 virtual void Shutdown() OVERRIDE;
[email protected]47665442012-07-27 02:31:2225 virtual bool DetermineDownloadTarget(
26 DownloadItem* download,
27 const DownloadTargetCallback& callback) OVERRIDE;
[email protected]e6669302013-03-25 14:31:1628 virtual bool ShouldOpenDownload(
29 DownloadItem* item,
30 const DownloadOpenDelayedCallback& callback) OVERRIDE;
[email protected]a558b43a2012-08-30 17:09:2731
32 // Inhibits prompting and sets the default download path.
33 void SetDownloadBehaviorForTesting(
[email protected]d30a36f2013-02-07 04:16:2634 const base::FilePath& default_download_path);
[email protected]98d6f152011-09-29 19:35:5135
[email protected]d6825972012-11-10 01:22:5236 protected:
37 // To allow subclasses for testing.
38 virtual ~ShellDownloadManagerDelegate();
39
[email protected]98d6f152011-09-29 19:35:5140 private:
41 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>;
42
[email protected]98d6f152011-09-29 19:35:5143
44 void GenerateFilename(int32 download_id,
[email protected]47665442012-07-27 02:31:2245 const DownloadTargetCallback& callback,
[email protected]d30a36f2013-02-07 04:16:2646 const base::FilePath& generated_name,
47 const base::FilePath& suggested_directory);
[email protected]a558b43a2012-08-30 17:09:2748 void OnDownloadPathGenerated(int32 download_id,
49 const DownloadTargetCallback& callback,
[email protected]d30a36f2013-02-07 04:16:2650 const base::FilePath& suggested_path);
[email protected]47665442012-07-27 02:31:2251 void ChooseDownloadPath(int32 download_id,
52 const DownloadTargetCallback& callback,
[email protected]d30a36f2013-02-07 04:16:2653 const base::FilePath& suggested_path);
[email protected]98d6f152011-09-29 19:35:5154
55 DownloadManager* download_manager_;
[email protected]d30a36f2013-02-07 04:16:2656 base::FilePath default_download_path_;
[email protected]a558b43a2012-08-30 17:09:2757 bool suppress_prompting_;
[email protected]98d6f152011-09-29 19:35:5158
59 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate);
60};
61
62} // namespace content
63
64#endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_