OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "content/browser/download/download_file.h" |
| 10 |
| 11 #include <string> |
| 12 |
| 13 #include "base/basictypes.h" |
| 14 #include "base/memory/ref_counted.h" |
| 15 #include "content/browser/download/download_request_handle.h" |
| 16 #include "content/common/content_export.h" |
| 17 |
| 18 struct DownloadCreateInfo; |
| 19 class DownloadManager; |
| 20 |
| 21 class CONTENT_EXPORT DownloadFileImpl : virtual public DownloadFile { |
| 22 public: |
| 23 // Takes ownership of the object pointed to by |request_handle|. |
| 24 DownloadFileImpl(const DownloadCreateInfo* info, |
| 25 DownloadRequestHandleInterface* request_handle, |
| 26 DownloadManager* download_manager); |
| 27 virtual ~DownloadFileImpl(); |
| 28 |
| 29 // DownloadFile functions. |
| 30 virtual net::Error Initialize(bool calculate_hash) OVERRIDE; |
| 31 virtual net::Error AppendDataToFile(const char* data, |
| 32 size_t data_len) OVERRIDE; |
| 33 virtual net::Error Rename(const FilePath& full_path) OVERRIDE; |
| 34 virtual void Detach() OVERRIDE; |
| 35 virtual void Cancel() OVERRIDE; |
| 36 virtual void Finish() OVERRIDE; |
| 37 virtual void AnnotateWithSourceInformation() OVERRIDE; |
| 38 virtual FilePath FullPath() const OVERRIDE; |
| 39 virtual bool InProgress() const OVERRIDE; |
| 40 virtual int64 BytesSoFar() const OVERRIDE; |
| 41 virtual bool GetSha256Hash(std::string* hash) OVERRIDE; |
| 42 virtual void CancelDownloadRequest() OVERRIDE; |
| 43 virtual int Id() const OVERRIDE; |
| 44 virtual DownloadManager* GetDownloadManager() OVERRIDE; |
| 45 virtual const DownloadId& GlobalId() const OVERRIDE; |
| 46 virtual std::string DebugString() const OVERRIDE; |
| 47 |
| 48 private: |
| 49 // The base file instance. |
| 50 BaseFile file_; |
| 51 |
| 52 // The unique identifier for this download, assigned at creation by |
| 53 // the DownloadFileManager for its internal record keeping. |
| 54 DownloadId id_; |
| 55 |
| 56 // The handle to the request information. Used for operations outside the |
| 57 // download system, specifically canceling a download. |
| 58 scoped_ptr<DownloadRequestHandleInterface> request_handle_; |
| 59 |
| 60 // DownloadManager this download belongs to. |
| 61 scoped_refptr<DownloadManager> download_manager_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 64 }; |
| 65 |
| 66 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
OLD | NEW |