Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: content/shell/shell_download_manager_delegate.h

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed indentation of calls to DownloadServiceFactory. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ 5 #ifndef CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_
6 #define CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ 6 #define CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "content/browser/download/download_manager_delegate.h" 11 #include "content/browser/download/download_manager_delegate.h"
12 12
13 class DownloadManager; 13 class DownloadManager;
14 struct DownloadStateInfo; 14 struct DownloadStateInfo;
15 15
16 namespace content { 16 namespace content {
17 17
18 class ShellDownloadManagerDelegate 18 class ShellDownloadManagerDelegate
19 : public DownloadManagerDelegate, 19 : public DownloadManagerDelegate,
20 public base::RefCountedThreadSafe<ShellDownloadManagerDelegate> { 20 public base::RefCountedThreadSafe<ShellDownloadManagerDelegate> {
21 public: 21 public:
22 ShellDownloadManagerDelegate(); 22 ShellDownloadManagerDelegate();
23 23
24 void SetDownloadManager(DownloadManager* download_manager);
25
26 virtual void Shutdown() OVERRIDE; 24 virtual void Shutdown() OVERRIDE;
27 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; 25 virtual bool ShouldStartDownload(int32 download_id) OVERRIDE;
28 virtual void ChooseDownloadPath(TabContents* tab_contents, 26 virtual void ChooseDownloadPath(TabContents* tab_contents,
29 const FilePath& suggested_path, 27 const FilePath& suggested_path,
30 void* data) OVERRIDE; 28 void* data) OVERRIDE;
31 virtual bool OverrideIntermediatePath(DownloadItem* item, 29 virtual bool OverrideIntermediatePath(DownloadItem* item,
32 FilePath* intermediate_path) OVERRIDE; 30 FilePath* intermediate_path) OVERRIDE;
33 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload() OVERRIDE; 31 virtual TabContents* GetAlternativeTabContentsToNotifyForDownload() OVERRIDE;
34 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; 32 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE;
35 virtual bool ShouldOpenDownload(DownloadItem* item) OVERRIDE; 33 virtual bool ShouldOpenDownload(DownloadItem* item) OVERRIDE;
(...skipping 10 matching lines...) Expand all
46 virtual void RemoveItemsFromPersistentStoreBetween( 44 virtual void RemoveItemsFromPersistentStoreBetween(
47 const base::Time remove_begin, 45 const base::Time remove_begin,
48 const base::Time remove_end) OVERRIDE; 46 const base::Time remove_end) OVERRIDE;
49 virtual void GetSaveDir(TabContents* tab_contents, 47 virtual void GetSaveDir(TabContents* tab_contents,
50 FilePath* website_save_dir, 48 FilePath* website_save_dir,
51 FilePath* download_save_dir) OVERRIDE; 49 FilePath* download_save_dir) OVERRIDE;
52 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package, 50 virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package,
53 const FilePath& suggested_path, 51 const FilePath& suggested_path,
54 bool can_save_as_complete) OVERRIDE; 52 bool can_save_as_complete) OVERRIDE;
55 virtual void DownloadProgressUpdated() OVERRIDE; 53 virtual void DownloadProgressUpdated() OVERRIDE;
54 virtual void SetDownloadManager(DownloadManager* manager) OVERRIDE;
56 55
57 private: 56 private:
58 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; 57 friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>;
59 58
60 virtual ~ShellDownloadManagerDelegate(); 59 virtual ~ShellDownloadManagerDelegate();
61 60
62 void GenerateFilename(int32 download_id, 61 void GenerateFilename(int32 download_id,
63 DownloadStateInfo state, 62 DownloadStateInfo state,
64 const FilePath& generated_name); 63 const FilePath& generated_name);
65 void RestartDownload(int32 download_id, 64 void RestartDownload(int32 download_id,
66 DownloadStateInfo state); 65 DownloadStateInfo state);
67 66
68 DownloadManager* download_manager_; 67 DownloadManager* download_manager_;
69 68
70 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate); 69 DISALLOW_COPY_AND_ASSIGN(ShellDownloadManagerDelegate);
71 }; 70 };
72 71
73 } // namespace content 72 } // namespace content
74 73
75 #endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_ 74 #endif // CONTENT_SHELL_SHELL_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698