| 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/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/public/browser/download_url_parameters.h" |
| 10 | 11 |
| 11 class DownloadFileManager; | 12 class DownloadFileManager; |
| 12 class DownloadItemImpl; | 13 class DownloadItemImpl; |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 class BrowserContext; | 16 class BrowserContext; |
| 16 } | 17 } |
| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 virtual bool ShouldOpenDownload(DownloadItemImpl* download); | 37 virtual bool ShouldOpenDownload(DownloadItemImpl* download); |
| 37 | 38 |
| 38 // Checks whether a downloaded file still exists and updates the | 39 // Checks whether a downloaded file still exists and updates the |
| 39 // file's state if the file is already removed. | 40 // file's state if the file is already removed. |
| 40 // The check may or may not result in a later asynchronous call | 41 // The check may or may not result in a later asynchronous call |
| 41 // to OnDownloadedFileRemoved(). | 42 // to OnDownloadedFileRemoved(). |
| 42 virtual void CheckForFileRemoval(DownloadItemImpl* download_item); | 43 virtual void CheckForFileRemoval(DownloadItemImpl* download_item); |
| 43 | 44 |
| 44 // If all pre-requisites have been met, complete download processing. | 45 // If all pre-requisites have been met, complete download processing. |
| 45 // TODO(rdsmith): Move into DownloadItem. | 46 // TODO(rdsmith): Move into DownloadItem. |
| 46 virtual void MaybeCompleteDownload(DownloadItemImpl* download); | 47 virtual void MaybeCompleteDownload(int32 download_id); |
| 48 |
| 49 // Called when an interrupted download is resumed. |
| 50 // |download_id| is the local ID of the download. |
| 51 virtual void RestartInterruptedDownload( |
| 52 DownloadItemImpl* download, |
| 53 const content::DownloadUrlParameters::OnStartedCallback& callback); |
| 47 | 54 |
| 48 // For contextual issues like language and prefs. | 55 // For contextual issues like language and prefs. |
| 49 virtual content::BrowserContext* GetBrowserContext() const; | 56 virtual content::BrowserContext* GetBrowserContext() const; |
| 50 | 57 |
| 51 // Get the DownloadFileManager to use for this download. | 58 // Get the DownloadFileManager to use for this download. |
| 52 virtual DownloadFileManager* GetDownloadFileManager(); | 59 virtual DownloadFileManager* GetDownloadFileManager(); |
| 53 | 60 |
| 54 // Handle any delegate portions of a state change operation on the | 61 // Handle any delegate portions of a state change operation on the |
| 55 // DownloadItem. | 62 // DownloadItem. |
| 56 virtual void DownloadStopped(DownloadItemImpl* download); | 63 virtual void DownloadStopped(DownloadItemImpl* download); |
| 57 virtual void DownloadCompleted(DownloadItemImpl* download); | 64 virtual void DownloadCompleted(DownloadItemImpl* download); |
| 58 virtual void DownloadOpened(DownloadItemImpl* download); | 65 virtual void DownloadOpened(DownloadItemImpl* download); |
| 59 virtual void DownloadRemoved(DownloadItemImpl* download); | 66 virtual void DownloadRemoved(DownloadItemImpl* download); |
| 60 virtual void DownloadRenamedToIntermediateName( | 67 virtual void DownloadRenamedToIntermediateName( |
| 61 DownloadItemImpl* download); | 68 DownloadItemImpl* download); |
| 62 virtual void DownloadRenamedToFinalName(DownloadItemImpl* download); | 69 virtual void DownloadRenamedToFinalName(DownloadItemImpl* download); |
| 63 | 70 |
| 64 // Assert consistent state for delgate object at various transitions. | 71 // Assert consistent state for delgate object at various transitions. |
| 65 virtual void AssertStateConsistent(DownloadItemImpl* download) const; | 72 virtual void AssertStateConsistent(DownloadItemImpl* download) const; |
| 66 | 73 |
| 67 private: | 74 private: |
| 68 // For "Outlives attached DownloadItemImpl" invariant assertion. | 75 // For "Outlives attached DownloadItemImpl" invariant assertion. |
| 69 int count_; | 76 int count_; |
| 70 | 77 |
| 71 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate); |
| 72 }; | 79 }; |
| 73 | 80 |
| 74 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ | 81 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_ |
| OLD | NEW |