Use "= delete" for DISALLOW_COPY and DISALLOW_ASSIGN.
[chromium-blink-merge.git] / content / shell / browser / shell_download_manager_delegate.h
blobbb1bfa0968949e96beb100f432af9b63d8bb505f
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_
8 #include "base/callback_forward.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/public/browser/download_manager_delegate.h"
13 namespace content {
15 class DownloadManager;
17 class ShellDownloadManagerDelegate : public DownloadManagerDelegate {
18 public:
19 ShellDownloadManagerDelegate();
20 ~ShellDownloadManagerDelegate() override;
22 void SetDownloadManager(DownloadManager* manager);
24 void Shutdown() override;
25 bool DetermineDownloadTarget(DownloadItem* download,
26 const DownloadTargetCallback& callback) override;
27 bool ShouldOpenDownload(DownloadItem* item,
28 const DownloadOpenDelayedCallback& callback) override;
29 void GetNextId(const DownloadIdCallback& callback) override;
31 // Inhibits prompting and sets the default download path.
32 void SetDownloadBehaviorForTesting(
33 const base::FilePath& default_download_path);
35 private:
36 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>;
38 typedef base::Callback<void(const base::FilePath&)>
39 FilenameDeterminedCallback;
41 static void GenerateFilename(const GURL& url,
42 const std::string& content_disposition,
43 const std::string& suggested_filename,
44 const std::string& mime_type,
45 const base::FilePath& suggested_directory,
46 const FilenameDeterminedCallback& callback);
47 void OnDownloadPathGenerated(uint32 download_id,
48 const DownloadTargetCallback& callback,
49 const base::FilePath& suggested_path);
50 void ChooseDownloadPath(uint32 download_id,
51 const DownloadTargetCallback& callback,
52 const base::FilePath& suggested_path);
54 DownloadManager* download_manager_;
55 base::FilePath default_download_path_;
56 bool suppress_prompting_;
57 base::WeakPtrFactory<ShellDownloadManagerDelegate> weak_ptr_factory_;
59 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate);
62 } // namespace content
64 #endif // CONTENT_SHELL_BROWSER_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_