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

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 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 12 matching lines...) Expand all
23 enum SaveState { 23 enum SaveState {
24 WAIT_START, 24 WAIT_START,
25 IN_PROGRESS, 25 IN_PROGRESS,
26 COMPLETE, 26 COMPLETE,
27 CANCELED 27 CANCELED
28 }; 28 };
29 29
30 SaveItem(const GURL& url, 30 SaveItem(const GURL& url,
31 const Referrer& referrer, 31 const Referrer& referrer,
32 SavePackage* package, 32 SavePackage* package,
33 SaveFileCreateInfo::SaveFileSource save_source); 33 SaveFileCreateInfo::SaveFileSource save_source,
34 int frame_tree_node_id);
34 35
35 ~SaveItem(); 36 ~SaveItem();
36 37
37 void Start(); 38 void Start();
38 39
39 // Received a new chunk of data. 40 // Received a new chunk of data.
40 void Update(int64_t bytes_so_far); 41 void Update(int64_t bytes_so_far);
41 42
42 // Cancel saving item. 43 // Cancel saving item.
43 void Cancel(); 44 void Cancel();
(...skipping 10 matching lines...) Expand all
54 55
55 void SetTotalBytes(int64_t total_bytes); 56 void SetTotalBytes(int64_t total_bytes);
56 57
57 // Accessors. 58 // Accessors.
58 SaveItemId id() const { return save_item_id_; } 59 SaveItemId id() const { return save_item_id_; }
59 SaveState state() const { return state_; } 60 SaveState state() const { return state_; }
60 const base::FilePath& full_path() const { return full_path_; } 61 const base::FilePath& full_path() const { return full_path_; }
61 const base::FilePath& file_name() const { return file_name_; } 62 const base::FilePath& file_name() const { return file_name_; }
62 const GURL& url() const { return url_; } 63 const GURL& url() const { return url_; }
63 const Referrer& referrer() const { return referrer_; } 64 const Referrer& referrer() const { return referrer_; }
65 int frame_tree_node_id() const { return frame_tree_node_id_; }
64 int64_t total_bytes() const { return total_bytes_; } 66 int64_t total_bytes() const { return total_bytes_; }
65 int64_t received_bytes() const { return received_bytes_; } 67 int64_t received_bytes() const { return received_bytes_; }
66 bool has_final_name() const { return has_final_name_; } 68 bool has_final_name() const { return has_final_name_; }
67 bool success() const { return is_success_; } 69 bool success() const { return is_success_; }
68 SaveFileCreateInfo::SaveFileSource save_source() const { 70 SaveFileCreateInfo::SaveFileSource save_source() const {
69 return save_source_; 71 return save_source_;
70 } 72 }
71 SavePackage* package() const { return package_; } 73 SavePackage* package() const { return package_; }
72 74
73 private: 75 private:
74 // Internal helper for maintaining consistent received and total sizes. 76 // Internal helper for maintaining consistent received and total sizes.
75 void UpdateSize(int64_t size); 77 void UpdateSize(int64_t size);
76 78
77 // Unique identifier for this SaveItem instance. 79 // Unique identifier for this SaveItem instance.
78 const SaveItemId save_item_id_; 80 const SaveItemId save_item_id_;
79 81
80 // Full path to the save item file. 82 // Full path to the save item file.
81 base::FilePath full_path_; 83 base::FilePath full_path_;
82 84
83 // Short display version of the file. 85 // Short display version of the file.
84 base::FilePath file_name_; 86 base::FilePath file_name_;
85 87
86 // The URL for this save item. 88 // The URL for this save item.
87 GURL url_; 89 GURL url_;
88 Referrer referrer_; 90 Referrer referrer_;
89 91
92 // Frame tree node id, if this save item represents a frame
93 // (otherwise FrameTreeNode::kFrameTreeNodeInvalidID).
94 int frame_tree_node_id_;
95
90 // Total bytes expected. 96 // Total bytes expected.
91 int64_t total_bytes_; 97 int64_t total_bytes_;
92 98
93 // Current received bytes. 99 // Current received bytes.
94 int64_t received_bytes_; 100 int64_t received_bytes_;
95 101
96 // The current state of this save item. 102 // The current state of this save item.
97 SaveState state_; 103 SaveState state_;
98 104
99 // Specifies if this name is a final or not. 105 // Specifies if this name is a final or not.
100 bool has_final_name_; 106 bool has_final_name_;
101 107
102 // Flag indicates whether SaveItem has error while in saving process. 108 // Flag indicates whether SaveItem has error while in saving process.
103 bool is_success_; 109 bool is_success_;
104 110
105 SaveFileCreateInfo::SaveFileSource save_source_; 111 SaveFileCreateInfo::SaveFileSource save_source_;
106 112
107 // Our owning object. 113 // Our owning object.
108 SavePackage* package_; 114 SavePackage* package_;
109 115
110 DISALLOW_COPY_AND_ASSIGN(SaveItem); 116 DISALLOW_COPY_AND_ASSIGN(SaveItem);
111 }; 117 };
112 118
113 } // namespace content 119 } // namespace content
114 120
115 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ 121 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_
OLDNEW
« no previous file with comments | « chrome/test/data/save_page/frames-runtime-changes.htm ('k') | content/browser/download/save_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698