OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/browser/download_danger_type.h" | 11 #include "content/public/browser/download_danger_type.h" |
12 #include "content/public/browser/download_item.h" | 12 #include "content/public/browser/download_item.h" |
| 13 #include "content/public/browser/download_url_parameters.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 class DownloadItemImpl; | 16 class DownloadItemImpl; |
16 class BrowserContext; | 17 class BrowserContext; |
17 | 18 |
18 // Delegate for operations that a DownloadItemImpl can't do for itself. | 19 // Delegate for operations that a DownloadItemImpl can't do for itself. |
19 // The base implementation of this class does nothing (returning false | 20 // The base implementation of this class does nothing (returning false |
20 // on predicates) so interfaces not of interest to a derived class may | 21 // on predicates) so interfaces not of interest to a derived class may |
21 // be left unimplemented. | 22 // be left unimplemented. |
22 class CONTENT_EXPORT DownloadItemImplDelegate { | 23 class CONTENT_EXPORT DownloadItemImplDelegate { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 59 |
59 // Tests if a file type should be opened automatically. | 60 // Tests if a file type should be opened automatically. |
60 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); | 61 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); |
61 | 62 |
62 // Checks whether a downloaded file still exists and updates the | 63 // Checks whether a downloaded file still exists and updates the |
63 // file's state if the file is already removed. | 64 // file's state if the file is already removed. |
64 // The check may or may not result in a later asynchronous call | 65 // The check may or may not result in a later asynchronous call |
65 // to OnDownloadedFileRemoved(). | 66 // to OnDownloadedFileRemoved(). |
66 virtual void CheckForFileRemoval(DownloadItemImpl* download_item); | 67 virtual void CheckForFileRemoval(DownloadItemImpl* download_item); |
67 | 68 |
| 69 // Called when an interrupted download is resumed. |
| 70 virtual void ResumeInterruptedDownload( |
| 71 scoped_ptr<content::DownloadUrlParameters> params, |
| 72 content::DownloadId id); |
| 73 |
68 // For contextual issues like language and prefs. | 74 // For contextual issues like language and prefs. |
69 virtual BrowserContext* GetBrowserContext() const; | 75 virtual BrowserContext* GetBrowserContext() const; |
70 | 76 |
71 // Update the persistent store with our information. | 77 // Update the persistent store with our information. |
72 virtual void UpdatePersistence(DownloadItemImpl* download); | 78 virtual void UpdatePersistence(DownloadItemImpl* download); |
73 | 79 |
74 // Handle any delegate portions of a state change operation on the | 80 // Handle any delegate portions of a state change operation on the |
75 // DownloadItem. | 81 // DownloadItem. |
76 virtual void DownloadOpened(DownloadItemImpl* download); | 82 virtual void DownloadOpened(DownloadItemImpl* download); |
77 virtual void DownloadRemoved(DownloadItemImpl* download); | 83 virtual void DownloadRemoved(DownloadItemImpl* download); |
78 | 84 |
79 // Show the download in the browser. | 85 // Show the download in the browser. |
80 virtual void ShowDownloadInBrowser(DownloadItemImpl* download); | 86 virtual void ShowDownloadInBrowser(DownloadItemImpl* download); |
81 | 87 |
82 // Assert consistent state for delgate object at various transitions. | 88 // Assert consistent state for delgate object at various transitions. |
83 virtual void AssertStateConsistent(DownloadItemImpl* download) const; | 89 virtual void AssertStateConsistent(DownloadItemImpl* download) const; |
84 | 90 |
85 private: | 91 private: |
86 // For "Outlives attached DownloadItemImpl" invariant assertion. | 92 // For "Outlives attached DownloadItemImpl" invariant assertion. |
87 int count_; | 93 int count_; |
88 | 94 |
89 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); | 95 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); |
90 }; | 96 }; |
91 | 97 |
92 } // namespace content | 98 } // namespace content |
93 | 99 |
94 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ | 100 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ |
OLD | NEW |