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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 60 |
60 // Tests if a file type should be opened automatically. | 61 // Tests if a file type should be opened automatically. |
61 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); | 62 virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); |
62 | 63 |
63 // Checks whether a downloaded file still exists and updates the | 64 // Checks whether a downloaded file still exists and updates the |
64 // file's state if the file is already removed. | 65 // file's state if the file is already removed. |
65 // The check may or may not result in a later asynchronous call | 66 // The check may or may not result in a later asynchronous call |
66 // to OnDownloadedFileRemoved(). | 67 // to OnDownloadedFileRemoved(). |
67 virtual void CheckForFileRemoval(DownloadItemImpl* download_item); | 68 virtual void CheckForFileRemoval(DownloadItemImpl* download_item); |
68 | 69 |
| 70 // Called when an interrupted download is resumed. |
| 71 virtual void ResumeInterruptedDownload( |
| 72 scoped_ptr<content::DownloadUrlParameters> params, |
| 73 content::DownloadId id); |
| 74 |
69 // For contextual issues like language and prefs. | 75 // For contextual issues like language and prefs. |
70 virtual BrowserContext* GetBrowserContext() const; | 76 virtual BrowserContext* GetBrowserContext() const; |
71 | 77 |
72 // Update the persistent store with our information. | 78 // Update the persistent store with our information. |
73 virtual void UpdatePersistence(DownloadItemImpl* download); | 79 virtual void UpdatePersistence(DownloadItemImpl* download); |
74 | 80 |
75 // Handle any delegate portions of a state change operation on the | 81 // Handle any delegate portions of a state change operation on the |
76 // DownloadItem. | 82 // DownloadItem. |
77 virtual void DownloadOpened(DownloadItemImpl* download); | 83 virtual void DownloadOpened(DownloadItemImpl* download); |
78 virtual void DownloadRemoved(DownloadItemImpl* download); | 84 virtual void DownloadRemoved(DownloadItemImpl* download); |
79 | 85 |
80 // Show the download in the browser. | 86 // Show the download in the browser. |
81 virtual void ShowDownloadInBrowser(DownloadItemImpl* download); | 87 virtual void ShowDownloadInBrowser(DownloadItemImpl* download); |
82 | 88 |
83 // Assert consistent state for delgate object at various transitions. | 89 // Assert consistent state for delgate object at various transitions. |
84 virtual void AssertStateConsistent(DownloadItemImpl* download) const; | 90 virtual void AssertStateConsistent(DownloadItemImpl* download) const; |
85 | 91 |
86 private: | 92 private: |
87 // For "Outlives attached DownloadItemImpl" invariant assertion. | 93 // For "Outlives attached DownloadItemImpl" invariant assertion. |
88 int count_; | 94 int count_; |
89 | 95 |
90 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); | 96 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); |
91 }; | 97 }; |
92 | 98 |
93 } // namespace content | 99 } // namespace content |
94 | 100 |
95 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ | 101 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ |
OLD | NEW |