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

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

Issue 10387090: Pass the referrer policy with the referrer for the save package code path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "content/browser/download/save_types.h" 11 #include "content/browser/download/save_types.h"
12 #include "content/public/common/referrer.h"
12 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
13 14
14 class SavePackage; 15 class SavePackage;
15 16
16 // 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
17 // state for one save file. 18 // state for one save file.
18 class SaveItem { 19 class SaveItem {
19 public: 20 public:
20 enum SaveState { 21 enum SaveState {
21 WAIT_START, 22 WAIT_START,
22 IN_PROGRESS, 23 IN_PROGRESS,
23 COMPLETE, 24 COMPLETE,
24 CANCELED 25 CANCELED
25 }; 26 };
26 27
27 SaveItem(const GURL& url, 28 SaveItem(const GURL& url,
28 const GURL& referrer, 29 const content::Referrer& referrer,
29 SavePackage* package, 30 SavePackage* package,
30 SaveFileCreateInfo::SaveFileSource save_source); 31 SaveFileCreateInfo::SaveFileSource save_source);
31 32
32 ~SaveItem(); 33 ~SaveItem();
33 34
34 void Start(); 35 void Start();
35 36
36 // Received a new chunk of data. 37 // Received a new chunk of data.
37 void Update(int64 bytes_so_far); 38 void Update(int64 bytes_so_far);
38 39
(...skipping 12 matching lines...) Expand all
51 52
52 void SetSaveId(int32 save_id); 53 void SetSaveId(int32 save_id);
53 54
54 void SetTotalBytes(int64 total_bytes); 55 void SetTotalBytes(int64 total_bytes);
55 56
56 // Accessors. 57 // Accessors.
57 SaveState state() const { return state_; } 58 SaveState state() const { return state_; }
58 const FilePath& full_path() const { return full_path_; } 59 const FilePath& full_path() const { return full_path_; }
59 const FilePath& file_name() const { return file_name_; } 60 const FilePath& file_name() const { return file_name_; }
60 const GURL& url() const { return url_; } 61 const GURL& url() const { return url_; }
61 const GURL& referrer() const { return referrer_; } 62 const content::Referrer& referrer() const { return referrer_; }
62 int64 total_bytes() const { return total_bytes_; } 63 int64 total_bytes() const { return total_bytes_; }
63 int64 received_bytes() const { return received_bytes_; } 64 int64 received_bytes() const { return received_bytes_; }
64 int32 save_id() const { return save_id_; } 65 int32 save_id() const { return save_id_; }
65 bool has_final_name() const { return has_final_name_; } 66 bool has_final_name() const { return has_final_name_; }
66 bool success() const { return is_success_; } 67 bool success() const { return is_success_; }
67 SaveFileCreateInfo::SaveFileSource save_source() const { 68 SaveFileCreateInfo::SaveFileSource save_source() const {
68 return save_source_; 69 return save_source_;
69 } 70 }
70 SavePackage* package() const { return package_; } 71 SavePackage* package() const { return package_; }
71 72
72 private: 73 private:
73 // Internal helper for maintaining consistent received and total sizes. 74 // Internal helper for maintaining consistent received and total sizes.
74 void UpdateSize(int64 size); 75 void UpdateSize(int64 size);
75 76
76 // Request ID assigned by the ResourceDispatcherHost. 77 // Request ID assigned by the ResourceDispatcherHost.
77 int32 save_id_; 78 int32 save_id_;
78 79
79 // Full path to the save item file. 80 // Full path to the save item file.
80 FilePath full_path_; 81 FilePath full_path_;
81 82
82 // Short display version of the file. 83 // Short display version of the file.
83 FilePath file_name_; 84 FilePath file_name_;
84 85
85 // The URL for this save item. 86 // The URL for this save item.
86 GURL url_; 87 GURL url_;
87 GURL referrer_; 88 content::Referrer referrer_;
88 89
89 // Total bytes expected. 90 // Total bytes expected.
90 int64 total_bytes_; 91 int64 total_bytes_;
91 92
92 // Current received bytes. 93 // Current received bytes.
93 int64 received_bytes_; 94 int64 received_bytes_;
94 95
95 // The current state of this save item. 96 // The current state of this save item.
96 SaveState state_; 97 SaveState state_;
97 98
98 // Specifies if this name is a final or not. 99 // Specifies if this name is a final or not.
99 bool has_final_name_; 100 bool has_final_name_;
100 101
101 // Flag indicates whether SaveItem has error while in saving process. 102 // Flag indicates whether SaveItem has error while in saving process.
102 bool is_success_; 103 bool is_success_;
103 104
104 SaveFileCreateInfo::SaveFileSource save_source_; 105 SaveFileCreateInfo::SaveFileSource save_source_;
105 106
106 // Our owning object. 107 // Our owning object.
107 SavePackage* package_; 108 SavePackage* package_;
108 109
109 DISALLOW_COPY_AND_ASSIGN(SaveItem); 110 DISALLOW_COPY_AND_ASSIGN(SaveItem);
110 }; 111 };
111 112
112 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_ 113 #endif // CONTENT_BROWSER_DOWNLOAD_SAVE_ITEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698