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

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

Issue 1373573002: ABANDONED: OOPIFs: Moving stitching of local paths from renderer to browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@page-serialization-recursive-begone
Patch Set: Self-review. Created 5 years, 2 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 "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"
11 #include "content/public/common/referrer.h" 11 #include "content/public/common/referrer.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace content { 14 namespace content {
15 class SavePackage; 15 class SavePackage;
16 16
17 // One SaveItem per save file. This is the model class that stores all the 17 // One SaveItem per save file. This is the model class that stores all the
18 // state for one save file. 18 // state for one save file.
19 class SaveItem { 19 class SaveItem {
20 public: 20 public:
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,
30 SavePackage* package, 29 SavePackage* package,
31 SaveFileCreateInfo::SaveFileSource save_source); 30 SaveFileCreateInfo::SaveFileSource save_source);
32 31
33 ~SaveItem(); 32 ~SaveItem();
34 33
35 void Start(); 34 void Start();
36 35
37 // Received a new chunk of data. 36 // Received a new chunk of data.
38 void Update(int64 bytes_so_far); 37 void Update(int64 bytes_so_far);
39 38
(...skipping 11 matching lines...) Expand all
51 void Rename(const base::FilePath& full_path); 50 void Rename(const base::FilePath& full_path);
52 51
53 void SetSaveId(int32 save_id); 52 void SetSaveId(int32 save_id);
54 53
55 void SetTotalBytes(int64 total_bytes); 54 void SetTotalBytes(int64 total_bytes);
56 55
57 // Accessors. 56 // Accessors.
58 SaveState state() const { return state_; } 57 SaveState state() const { return state_; }
59 const base::FilePath& full_path() const { return full_path_; } 58 const base::FilePath& full_path() const { return full_path_; }
60 const base::FilePath& file_name() const { return file_name_; } 59 const base::FilePath& file_name() const { return file_name_; }
60 int frame_tree_node_id() const { return frame_tree_node_id_; }
61 const GURL& url() const { return url_; } 61 const GURL& url() const { return url_; }
62 const Referrer& referrer() const { return referrer_; } 62 const Referrer& referrer() const { return referrer_; }
63 int64 total_bytes() const { return total_bytes_; } 63 int64 total_bytes() const { return total_bytes_; }
64 int64 received_bytes() const { return received_bytes_; } 64 int64 received_bytes() const { return received_bytes_; }
65 int32 save_id() const { return save_id_; } 65 int32 save_id() const { return save_id_; }
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 // Setters.
74 void set_frame_tree_node_id(int id) { frame_tree_node_id_ = id; }
75 void set_referrer(const Referrer& referrer) { referrer_ = referrer; }
76
73 private: 77 private:
74 // Internal helper for maintaining consistent received and total sizes. 78 // Internal helper for maintaining consistent received and total sizes.
75 void UpdateSize(int64 size); 79 void UpdateSize(int64 size);
76 80
77 // Request ID assigned by the ResourceDispatcherHost. 81 // Request ID assigned by the ResourceDispatcherHost.
78 int32 save_id_; 82 int32 save_id_;
79 83
80 // Full path to the save item file. 84 // Full path to the save item file.
81 base::FilePath full_path_; 85 base::FilePath full_path_;
82 86
83 // Short display version of the file. 87 // Short display version of the file.
84 base::FilePath file_name_; 88 base::FilePath file_name_;
85 89
90 // Frame tree node id (if this SaveItem is associated with a frame).
91 int frame_tree_node_id_;
92
86 // The URL for this save item. 93 // The URL for this save item.
87 GURL url_; 94 GURL url_;
88 Referrer referrer_; 95 Referrer referrer_;
89 96
90 // Total bytes expected. 97 // Total bytes expected.
91 int64 total_bytes_; 98 int64 total_bytes_;
92 99
93 // Current received bytes. 100 // Current received bytes.
94 int64 received_bytes_; 101 int64 received_bytes_;
95 102
(...skipping 10 matching lines...) Expand all
106 113
107 // Our owning object. 114 // Our owning object.
108 SavePackage* package_; 115 SavePackage* package_;
109 116
110 DISALLOW_COPY_AND_ASSIGN(SaveItem); 117 DISALLOW_COPY_AND_ASSIGN(SaveItem);
111 }; 118 };
112 119
113 } // namespace content 120 } // namespace content
114 121
115 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ 122 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698