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

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

Issue 1502563004: Save-Page-As-Complete-Html: Each frame links to a distinct local file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-url-deduping-for-frame-and-adding-save-item-id
Patch Set: Rebasing... Created 5 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
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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "content/browser/download/save_types.h" 10 #include "content/browser/download/save_types.h"
(...skipping 10 matching lines...) Expand all
21 enum SaveState { 21 enum SaveState {
22 WAIT_START, 22 WAIT_START,
23 IN_PROGRESS, 23 IN_PROGRESS,
24 COMPLETE, 24 COMPLETE,
25 CANCELED 25 CANCELED
26 }; 26 };
27 27
28 SaveItem(const GURL& url, 28 SaveItem(const GURL& url,
29 const Referrer& referrer, 29 const Referrer& referrer,
30 SavePackage* package, 30 SavePackage* package,
31 SaveFileCreateInfo::SaveFileSource save_source); 31 SaveFileCreateInfo::SaveFileSource save_source,
32 int frame_tree_node_id);
32 33
33 ~SaveItem(); 34 ~SaveItem();
34 35
35 void Start(); 36 void Start();
36 37
37 // Received a new chunk of data. 38 // Received a new chunk of data.
38 void Update(int64 bytes_so_far); 39 void Update(int64 bytes_so_far);
39 40
40 // Cancel saving item. 41 // Cancel saving item.
41 void Cancel(); 42 void Cancel();
(...skipping 10 matching lines...) Expand all
52 53
53 void SetTotalBytes(int64 total_bytes); 54 void SetTotalBytes(int64 total_bytes);
54 55
55 // Accessors. 56 // Accessors.
56 int id() const { return save_item_id_; } 57 int id() const { return save_item_id_; }
57 SaveState state() const { return state_; } 58 SaveState state() const { return state_; }
58 const base::FilePath& full_path() const { return full_path_; } 59 const base::FilePath& full_path() const { return full_path_; }
59 const base::FilePath& file_name() const { return file_name_; } 60 const base::FilePath& file_name() const { return file_name_; }
60 const GURL& url() const { return url_; } 61 const GURL& url() const { return url_; }
61 const Referrer& referrer() const { return referrer_; } 62 const Referrer& referrer() const { return referrer_; }
63 int frame_tree_node_id() const { return frame_tree_node_id_; }
62 int64 total_bytes() const { return total_bytes_; } 64 int64 total_bytes() const { return total_bytes_; }
63 int64 received_bytes() const { return received_bytes_; } 65 int64 received_bytes() const { return received_bytes_; }
64 bool has_final_name() const { return has_final_name_; } 66 bool has_final_name() const { return has_final_name_; }
65 bool success() const { return is_success_; } 67 bool success() const { return is_success_; }
66 SaveFileCreateInfo::SaveFileSource save_source() const { 68 SaveFileCreateInfo::SaveFileSource save_source() const {
67 return save_source_; 69 return save_source_;
68 } 70 }
69 SavePackage* package() const { return package_; } 71 SavePackage* package() const { return package_; }
70 72
71 private: 73 private:
72 // Internal helper for maintaining consistent received and total sizes. 74 // Internal helper for maintaining consistent received and total sizes.
73 void UpdateSize(int64 size); 75 void UpdateSize(int64 size);
74 76
75 // Unique identifier for this SaveItem instance. 77 // Unique identifier for this SaveItem instance.
76 const int save_item_id_; 78 const int save_item_id_;
77 79
78 // Full path to the save item file. 80 // Full path to the save item file.
79 base::FilePath full_path_; 81 base::FilePath full_path_;
80 82
81 // Short display version of the file. 83 // Short display version of the file.
82 base::FilePath file_name_; 84 base::FilePath file_name_;
83 85
84 // The URL for this save item. 86 // The URL for this save item.
85 GURL url_; 87 GURL url_;
86 Referrer referrer_; 88 Referrer referrer_;
87 89
90 // Frame tree node id, if this save item represents a frame
91 // (otherwise FrameTreeNode::kFrameTreeNodeInvalidID).
92 int frame_tree_node_id_;
93
88 // Total bytes expected. 94 // Total bytes expected.
89 int64 total_bytes_; 95 int64 total_bytes_;
90 96
91 // Current received bytes. 97 // Current received bytes.
92 int64 received_bytes_; 98 int64 received_bytes_;
93 99
94 // The current state of this save item. 100 // The current state of this save item.
95 SaveState state_; 101 SaveState state_;
96 102
97 // Specifies if this name is a final or not. 103 // Specifies if this name is a final or not.
98 bool has_final_name_; 104 bool has_final_name_;
99 105
100 // Flag indicates whether SaveItem has error while in saving process. 106 // Flag indicates whether SaveItem has error while in saving process.
101 bool is_success_; 107 bool is_success_;
102 108
103 SaveFileCreateInfo::SaveFileSource save_source_; 109 SaveFileCreateInfo::SaveFileSource save_source_;
104 110
105 // Our owning object. 111 // Our owning object.
106 SavePackage* package_; 112 SavePackage* package_;
107 113
108 DISALLOW_COPY_AND_ASSIGN(SaveItem); 114 DISALLOW_COPY_AND_ASSIGN(SaveItem);
109 }; 115 };
110 116
111 } // namespace content 117 } // namespace content
112 118
113 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ 119 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698