Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: content/browser/download/download_file_impl.h

Issue 8404049: Added member data to classes to support download resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/public/browser/download_file.h" 9 #include "content/public/browser/download_file.h"
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "content/browser/download/base_file.h" 15 #include "content/browser/download/base_file.h"
16 #include "content/browser/download/download_request_handle.h" 16 #include "content/browser/download/download_request_handle.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 18
19 struct DownloadCreateInfo; 19 struct DownloadCreateInfo;
20 20
21 namespace content { 21 namespace content {
22 class DownloadManager; 22 class DownloadManager;
23 } 23 }
24 24
25 class CONTENT_EXPORT DownloadFileImpl : virtual public content::DownloadFile { 25 class CONTENT_EXPORT DownloadFileImpl : virtual public content::DownloadFile {
26 public: 26 public:
27 // Takes ownership of the object pointed to by |request_handle|. 27 // Takes ownership of the object pointed to by |request_handle|.
28 DownloadFileImpl(const DownloadCreateInfo* info, 28 DownloadFileImpl(const DownloadCreateInfo* info,
29 DownloadRequestHandleInterface* request_handle, 29 DownloadRequestHandleInterface* request_handle,
30 content::DownloadManager* download_manager); 30 content::DownloadManager* download_manager,
31 bool calculate_hash);
31 virtual ~DownloadFileImpl(); 32 virtual ~DownloadFileImpl();
32 33
33 // DownloadFile functions. 34 // DownloadFile functions.
34 virtual net::Error Initialize(bool calculate_hash) OVERRIDE; 35 virtual net::Error Initialize() OVERRIDE;
35 virtual net::Error AppendDataToFile(const char* data, 36 virtual net::Error AppendDataToFile(const char* data,
36 size_t data_len) OVERRIDE; 37 size_t data_len) OVERRIDE;
37 virtual net::Error Rename(const FilePath& full_path) OVERRIDE; 38 virtual net::Error Rename(const FilePath& full_path) OVERRIDE;
38 virtual void Detach() OVERRIDE; 39 virtual void Detach() OVERRIDE;
39 virtual void Cancel() OVERRIDE; 40 virtual void Cancel() OVERRIDE;
40 virtual void Finish() OVERRIDE; 41 virtual void Finish() OVERRIDE;
41 virtual void AnnotateWithSourceInformation() OVERRIDE; 42 virtual void AnnotateWithSourceInformation() OVERRIDE;
42 virtual FilePath FullPath() const OVERRIDE; 43 virtual FilePath FullPath() const OVERRIDE;
43 virtual bool InProgress() const OVERRIDE; 44 virtual bool InProgress() const OVERRIDE;
44 virtual int64 BytesSoFar() const OVERRIDE; 45 virtual int64 BytesSoFar() const OVERRIDE;
45 virtual int64 CurrentSpeed() const OVERRIDE; 46 virtual int64 CurrentSpeed() const OVERRIDE;
46 virtual bool GetSha256Hash(std::string* hash) OVERRIDE; 47 virtual bool GetHash(std::string* hash) OVERRIDE;
48 virtual std::string GetHashState() OVERRIDE;
47 virtual void CancelDownloadRequest() OVERRIDE; 49 virtual void CancelDownloadRequest() OVERRIDE;
48 virtual int Id() const OVERRIDE; 50 virtual int Id() const OVERRIDE;
49 virtual content::DownloadManager* GetDownloadManager() OVERRIDE; 51 virtual content::DownloadManager* GetDownloadManager() OVERRIDE;
50 virtual const DownloadId& GlobalId() const OVERRIDE; 52 virtual const DownloadId& GlobalId() const OVERRIDE;
51 virtual std::string DebugString() const OVERRIDE; 53 virtual std::string DebugString() const OVERRIDE;
52 54
53 private: 55 private:
54 // The base file instance. 56 // The base file instance.
55 BaseFile file_; 57 BaseFile file_;
56 58
57 // The unique identifier for this download, assigned at creation by 59 // The unique identifier for this download, assigned at creation by
58 // the DownloadFileManager for its internal record keeping. 60 // the DownloadFileManager for its internal record keeping.
59 DownloadId id_; 61 DownloadId id_;
60 62
61 // The handle to the request information. Used for operations outside the 63 // The handle to the request information. Used for operations outside the
62 // download system, specifically canceling a download. 64 // download system, specifically canceling a download.
63 scoped_ptr<DownloadRequestHandleInterface> request_handle_; 65 scoped_ptr<DownloadRequestHandleInterface> request_handle_;
64 66
65 // DownloadManager this download belongs to. 67 // DownloadManager this download belongs to.
66 scoped_refptr<content::DownloadManager> download_manager_; 68 scoped_refptr<content::DownloadManager> download_manager_;
67 69
68 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); 70 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl);
69 }; 71 };
70 72
71 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 73 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_create_info.h ('k') | content/browser/download/download_file_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698