| 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_FILE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "content/browser/download/download_file.h" | 9 #include "content/browser/download/download_file.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 DownloadFileImpl(const DownloadCreateInfo* info, | 33 DownloadFileImpl(const DownloadCreateInfo* info, |
| 34 scoped_ptr<content::ByteStreamReader> stream, | 34 scoped_ptr<content::ByteStreamReader> stream, |
| 35 DownloadRequestHandleInterface* request_handle, | 35 DownloadRequestHandleInterface* request_handle, |
| 36 scoped_refptr<content::DownloadManager> download_manager, | 36 scoped_refptr<content::DownloadManager> download_manager, |
| 37 bool calculate_hash, | 37 bool calculate_hash, |
| 38 scoped_ptr<content::PowerSaveBlocker> power_save_blocker, | 38 scoped_ptr<content::PowerSaveBlocker> power_save_blocker, |
| 39 const net::BoundNetLog& bound_net_log); | 39 const net::BoundNetLog& bound_net_log); |
| 40 virtual ~DownloadFileImpl(); | 40 virtual ~DownloadFileImpl(); |
| 41 | 41 |
| 42 // DownloadFile functions. | 42 // DownloadFile functions. |
| 43 virtual net::Error Initialize() OVERRIDE; | 43 virtual content::DownloadInterruptReason Initialize() OVERRIDE; |
| 44 virtual net::Error Rename(const FilePath& full_path) OVERRIDE; | 44 virtual content::DownloadInterruptReason Rename( |
| 45 const FilePath& full_path) OVERRIDE; |
| 45 virtual void Detach() OVERRIDE; | 46 virtual void Detach() OVERRIDE; |
| 46 virtual void Cancel() OVERRIDE; | 47 virtual void Cancel() OVERRIDE; |
| 47 virtual void AnnotateWithSourceInformation() OVERRIDE; | 48 virtual void AnnotateWithSourceInformation() OVERRIDE; |
| 48 virtual FilePath FullPath() const OVERRIDE; | 49 virtual FilePath FullPath() const OVERRIDE; |
| 49 virtual bool InProgress() const OVERRIDE; | 50 virtual bool InProgress() const OVERRIDE; |
| 50 virtual int64 BytesSoFar() const OVERRIDE; | 51 virtual int64 BytesSoFar() const OVERRIDE; |
| 51 virtual int64 CurrentSpeed() const OVERRIDE; | 52 virtual int64 CurrentSpeed() const OVERRIDE; |
| 52 virtual bool GetHash(std::string* hash) OVERRIDE; | 53 virtual bool GetHash(std::string* hash) OVERRIDE; |
| 53 virtual std::string GetHashState() OVERRIDE; | 54 virtual std::string GetHashState() OVERRIDE; |
| 54 virtual void CancelDownloadRequest() OVERRIDE; | 55 virtual void CancelDownloadRequest() OVERRIDE; |
| 55 virtual int Id() const OVERRIDE; | 56 virtual int Id() const OVERRIDE; |
| 56 virtual content::DownloadManager* GetDownloadManager() OVERRIDE; | 57 virtual content::DownloadManager* GetDownloadManager() OVERRIDE; |
| 57 virtual const content::DownloadId& GlobalId() const OVERRIDE; | 58 virtual const content::DownloadId& GlobalId() const OVERRIDE; |
| 58 virtual std::string DebugString() const OVERRIDE; | 59 virtual std::string DebugString() const OVERRIDE; |
| 59 | 60 |
| 60 protected: | 61 protected: |
| 61 // For test class overrides. | 62 // For test class overrides. |
| 62 virtual net::Error AppendDataToFile(const char* data, | 63 virtual content::DownloadInterruptReason AppendDataToFile( |
| 63 size_t data_len); | 64 const char* data, size_t data_len); |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 // Called when there's some activity on stream_reader_ that needs to be | 67 // Called when there's some activity on stream_reader_ that needs to be |
| 67 // handled. | 68 // handled. |
| 68 void StreamActive(); | 69 void StreamActive(); |
| 69 | 70 |
| 70 // Send updates on our progress. | 71 // Send updates on our progress. |
| 71 void SendUpdate(); | 72 void SendUpdate(); |
| 72 | 73 |
| 73 // The base file instance. | 74 // The base file instance. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 102 | 103 |
| 103 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 104 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
| 104 | 105 |
| 105 // RAII handle to keep the system from sleeping while we're downloading. | 106 // RAII handle to keep the system from sleeping while we're downloading. |
| 106 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; | 107 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; |
| 107 | 108 |
| 108 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 109 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 112 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| OLD | NEW |