Chromium Code Reviews| 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 // These objects live exclusively on the download thread and handle the writing | |
|
Randy Smith (Not in Mondays)
2011/11/10 21:58:43
nit: Could you change "download thread" to "file
ahendrickson
2011/11/13 00:50:21
Done.
| |
| 22 // operations for one download. These objects live only for the duration that | |
| 23 // the download is 'in progress': once the download has been completed or | |
| 24 // cancelled, the DownloadFile is destroyed. | |
|
Randy Smith (Not in Mondays)
2011/11/10 21:58:43
I'm ambivalent (so if you have a strong feeling, l
ahendrickson
2011/11/13 00:50:21
Done.
| |
| 25 class CONTENT_EXPORT DownloadFileImpl : virtual public DownloadFile { | |
| 26 public: | |
| 27 // Takes ownership of the object pointed to by |request_handle|. | |
| 28 DownloadFileImpl(const DownloadCreateInfo* info, | |
| 29 DownloadRequestHandleInterface* request_handle, | |
| 30 DownloadManager* download_manager); | |
| 31 virtual ~DownloadFileImpl(); | |
| 32 | |
| 33 // BaseFile delegated functions. | |
|
Randy Smith (Not in Mondays)
2011/11/10 21:58:43
nit: The fact that these are delegated to the Base
ahendrickson
2011/11/13 00:50:21
Done.
| |
| 34 virtual net::Error Initialize(bool calculate_hash); | |
| 35 virtual net::Error AppendDataToFile(const char* data, size_t data_len); | |
| 36 virtual net::Error Rename(const FilePath& full_path); | |
| 37 virtual void Detach(); | |
| 38 virtual void Cancel(); | |
| 39 virtual void Finish(); | |
| 40 virtual void AnnotateWithSourceInformation(); | |
| 41 virtual FilePath FullPath() const; | |
| 42 virtual bool InProgress() const; | |
| 43 virtual int64 BytesSoFar() const; | |
| 44 virtual bool GetSha256Hash(std::string* hash); | |
| 45 | |
| 46 // DownloadFile implementation. | |
|
Randy Smith (Not in Mondays)
2011/11/10 21:58:43
The above is part of the DownloadFile implementati
Randy Smith (Not in Mondays)
2011/11/10 21:58:43
Shouldn't all functions that inherit from the Down
ahendrickson
2011/11/13 00:50:21
Yes
ahendrickson
2011/11/13 00:50:21
Done.
| |
| 47 virtual void CancelDownloadRequest(); | |
| 48 virtual int Id() const; | |
| 49 virtual DownloadManager* GetDownloadManager(); | |
| 50 virtual const DownloadId& GlobalId() const; | |
| 51 virtual std::string DebugString() const; | |
| 52 | |
| 53 private: | |
| 54 // The base file instance. | |
| 55 BaseFile file_; | |
| 56 | |
| 57 // The unique identifier for this download, assigned at creation by | |
| 58 // the DownloadFileManager for its internal record keeping. | |
| 59 DownloadId id_; | |
| 60 | |
| 61 // The handle to the request information. Used for operations outside the | |
| 62 // download system, specifically canceling a download. | |
| 63 scoped_ptr<DownloadRequestHandleInterface> request_handle_; | |
| 64 | |
| 65 // DownloadManager this download belongs to. | |
| 66 scoped_refptr<DownloadManager> download_manager_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | |
| 69 }; | |
| 70 | |
| 71 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | |
| OLD | NEW |