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

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

Issue 1529363006: Introducing SavePackageId and SaveItemId as distinct IdType<...>-based types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback from Daniel. Created 4 years, 11 months 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
OLDNEW
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_SAVE_ITEM_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_
6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // Rough percent complete, -1 means we don't know (since we didn't receive a 48 // Rough percent complete, -1 means we don't know (since we didn't receive a
49 // total size). 49 // total size).
50 int PercentComplete() const; 50 int PercentComplete() const;
51 51
52 // Update path for SaveItem, the actual file is renamed on the file thread. 52 // Update path for SaveItem, the actual file is renamed on the file thread.
53 void Rename(const base::FilePath& full_path); 53 void Rename(const base::FilePath& full_path);
54 54
55 void SetTotalBytes(int64_t total_bytes); 55 void SetTotalBytes(int64_t total_bytes);
56 56
57 // Accessors. 57 // Accessors.
58 int id() const { return save_item_id_; } 58 SaveItemId id() const { return save_item_id_; }
59 SaveState state() const { return state_; } 59 SaveState state() const { return state_; }
60 const base::FilePath& full_path() const { return full_path_; } 60 const base::FilePath& full_path() const { return full_path_; }
61 const base::FilePath& file_name() const { return file_name_; } 61 const base::FilePath& file_name() const { return file_name_; }
62 const GURL& url() const { return url_; } 62 const GURL& url() const { return url_; }
63 const Referrer& referrer() const { return referrer_; } 63 const Referrer& referrer() const { return referrer_; }
64 int64_t total_bytes() const { return total_bytes_; } 64 int64_t total_bytes() const { return total_bytes_; }
65 int64_t received_bytes() const { return received_bytes_; } 65 int64_t received_bytes() const { return received_bytes_; }
66 bool has_final_name() const { return has_final_name_; } 66 bool has_final_name() const { return has_final_name_; }
67 bool success() const { return is_success_; } 67 bool success() const { return is_success_; }
68 SaveFileCreateInfo::SaveFileSource save_source() const { 68 SaveFileCreateInfo::SaveFileSource save_source() const {
69 return save_source_; 69 return save_source_;
70 } 70 }
71 SavePackage* package() const { return package_; } 71 SavePackage* package() const { return package_; }
72 72
73 private: 73 private:
74 // Internal helper for maintaining consistent received and total sizes. 74 // Internal helper for maintaining consistent received and total sizes.
75 void UpdateSize(int64_t size); 75 void UpdateSize(int64_t size);
76 76
77 // Unique identifier for this SaveItem instance. 77 // Unique identifier for this SaveItem instance.
78 const int save_item_id_; 78 const SaveItemId save_item_id_;
79 79
80 // Full path to the save item file. 80 // Full path to the save item file.
81 base::FilePath full_path_; 81 base::FilePath full_path_;
82 82
83 // Short display version of the file. 83 // Short display version of the file.
84 base::FilePath file_name_; 84 base::FilePath file_name_;
85 85
86 // The URL for this save item. 86 // The URL for this save item.
87 GURL url_; 87 GURL url_;
88 Referrer referrer_; 88 Referrer referrer_;
(...skipping 17 matching lines...) Expand all
106 106
107 // Our owning object. 107 // Our owning object.
108 SavePackage* package_; 108 SavePackage* package_;
109 109
110 DISALLOW_COPY_AND_ASSIGN(SaveItem); 110 DISALLOW_COPY_AND_ASSIGN(SaveItem);
111 }; 111 };
112 112
113 } // namespace content 113 } // namespace content
114 114
115 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ 115 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_
OLDNEW
« no previous file with comments | « content/browser/download/save_file_resource_handler.cc ('k') | content/browser/download/save_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698