OLD | NEW |
---|---|
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_DOWNLOAD_NET_LOG_PARAMETERS_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "content/public/browser/download_item.h" | |
11 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
12 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
13 | 14 |
14 namespace download_net_logs { | 15 namespace download_net_logs { |
15 | 16 |
17 enum DownloadType { | |
18 SRC_NEW_DOWNLOAD, | |
19 SRC_HISTORY_IMPORT, | |
20 SRC_SAVE_PAGE_AS | |
21 }; | |
22 | |
23 // NetLog parameters when a DownloadItem is activated. | |
24 class ItemActivatedParameters : public net::NetLog::EventParameters { | |
25 public: | |
26 ItemActivatedParameters(DownloadType download_type, | |
27 int64 id, | |
28 const std::string& original_url, | |
29 const std::string& final_url, | |
30 const std::string& intermediate_name, | |
31 const std::string& suggested_name, | |
Randy Smith (Not in Mondays)
2012/02/05 23:49:15
The names of these parameters seem misleading to m
ahendrickson
2012/02/06 21:39:20
Done.
| |
32 content::DownloadItem::SafetyState safety_state, | |
Randy Smith (Not in Mondays)
2012/02/05 23:49:15
In what circumstances will this have information i
ahendrickson
2012/02/06 21:39:20
In the case of a History download, I believe.
Randy Smith (Not in Mondays)
2012/02/06 22:34:59
Hmmm. I'm having a hard time imagining a situatio
Randy Smith (Not in Mondays)
2012/02/07 15:09:45
When you switched to DownloadDangerType I checked
ahendrickson
2012/02/07 17:18:35
We will persist both when download resumption is i
| |
33 int64 start_offset); | |
34 virtual ~ItemActivatedParameters(); | |
35 virtual base::Value* ToValue() const OVERRIDE; | |
36 | |
37 private: | |
38 const DownloadType type_; | |
39 const int64 id_; | |
40 const std::string original_url_; | |
41 const std::string final_url_; | |
42 const std::string intermediate_filename_; | |
43 const std::string suggested_final_filename_; | |
44 const content::DownloadItem::SafetyState safety_state_; | |
45 const int64 start_offset_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(ItemActivatedParameters); | |
48 }; | |
49 | |
50 // NetLog parameters when a DownloadItem is checked for danger. | |
51 class ItemCheckedParameters : public net::NetLog::EventParameters { | |
52 public: | |
53 ItemCheckedParameters(content::DownloadItem::SafetyState safety_state); | |
54 virtual base::Value* ToValue() const OVERRIDE; | |
55 | |
56 private: | |
57 const content::DownloadItem::SafetyState safety_state_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(ItemCheckedParameters); | |
60 }; | |
61 | |
62 // NetLog parameters when a DownloadItem is added to the history database. | |
63 class ItemInHistoryParameters : public net::NetLog::EventParameters { | |
64 public: | |
65 ItemInHistoryParameters(int64 handle); | |
66 virtual base::Value* ToValue() const OVERRIDE; | |
67 | |
68 private: | |
69 const int64 db_handle_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(ItemInHistoryParameters); | |
72 }; | |
73 | |
74 // NetLog parameters when a DownloadItem is updated. | |
75 class ItemUpdatedParameters : public net::NetLog::EventParameters { | |
76 public: | |
77 ItemUpdatedParameters(int64 bytes_so_far, const std::string& hash_state); | |
78 virtual base::Value* ToValue() const OVERRIDE; | |
79 | |
80 private: | |
81 const int64 bytes_so_far_; | |
82 const std::string hash_state_; | |
Randy Smith (Not in Mondays)
2012/02/05 23:49:15
What's the value in logging the hash state? (Ditt
ahendrickson
2012/02/06 21:39:20
Removed.
| |
83 | |
84 DISALLOW_COPY_AND_ASSIGN(ItemUpdatedParameters); | |
85 }; | |
86 | |
87 // NetLog parameters when a DownloadItem is renamed. | |
88 class ItemRenamedParameters : public net::NetLog::EventParameters { | |
89 public: | |
90 ItemRenamedParameters( | |
91 const std::string& old_filename, const std::string& new_filename); | |
92 virtual base::Value* ToValue() const OVERRIDE; | |
93 | |
94 private: | |
95 const std::string old_filename_; | |
96 const std::string new_filename_; | |
97 | |
98 DISALLOW_COPY_AND_ASSIGN(ItemRenamedParameters); | |
99 }; | |
100 | |
101 // NetLog parameters when a DownloadItem is interrupted. | |
102 class ItemInterruptedParameters : public net::NetLog::EventParameters { | |
103 public: | |
104 ItemInterruptedParameters(InterruptReason reason, | |
105 int64 bytes_so_far, | |
106 const std::string& hash_state); | |
107 virtual base::Value* ToValue() const OVERRIDE; | |
108 | |
109 private: | |
110 const InterruptReason reason_; | |
111 const int64 bytes_so_far_; | |
112 const std::string hash_state_; | |
113 | |
114 DISALLOW_COPY_AND_ASSIGN(ItemInterruptedParameters); | |
115 }; | |
116 | |
117 // NetLog parameters when a DownloadItem is resumed. | |
118 class ItemResumedParameters : public net::NetLog::EventParameters { | |
Randy Smith (Not in Mondays)
2012/02/05 23:49:15
This doesn't look like it's used in this CL. If s
ahendrickson
2012/02/06 21:39:20
Done.
| |
119 public: | |
120 ItemResumedParameters(bool user_initiated, | |
121 InterruptReason reason, | |
122 int64 bytes_so_far, | |
123 const std::string& hash_state); | |
124 virtual base::Value* ToValue() const OVERRIDE; | |
125 | |
126 private: | |
127 const bool user_initiated_; | |
128 const InterruptReason reason_; | |
129 const int64 bytes_so_far_; | |
130 const std::string hash_state_; | |
131 | |
132 DISALLOW_COPY_AND_ASSIGN(ItemResumedParameters); | |
133 }; | |
134 | |
135 // NetLog parameters when a DownloadItem is finished. | |
136 class ItemFinishedParameters : public net::NetLog::EventParameters { | |
137 public: | |
138 ItemFinishedParameters(int64 bytes_so_far, const std::string& final_hash); | |
139 virtual base::Value* ToValue() const OVERRIDE; | |
140 | |
141 private: | |
142 const int64 bytes_so_far_; | |
143 const std::string final_hash_; | |
144 | |
145 DISALLOW_COPY_AND_ASSIGN(ItemFinishedParameters); | |
146 }; | |
147 | |
148 // NetLog parameters when a DownloadItem is canceled. | |
149 class ItemCanceledParameters : public net::NetLog::EventParameters { | |
150 public: | |
151 ItemCanceledParameters(int64 bytes_so_far, const std::string& hash_state); | |
152 virtual base::Value* ToValue() const OVERRIDE; | |
153 | |
154 private: | |
155 const int64 bytes_so_far_; | |
156 const std::string hash_state_; | |
157 | |
158 DISALLOW_COPY_AND_ASSIGN(ItemCanceledParameters); | |
159 }; | |
160 | |
16 // NetLog parameters when a DownloadFile is opened. | 161 // NetLog parameters when a DownloadFile is opened. |
17 class FileOpenedParameters : public net::NetLog::EventParameters { | 162 class FileOpenedParameters : public net::NetLog::EventParameters { |
18 public: | 163 public: |
19 FileOpenedParameters(const std::string& file_name, | 164 FileOpenedParameters(const std::string& file_name, |
20 int64 start_offset); | 165 int64 start_offset); |
21 virtual base::Value* ToValue() const OVERRIDE; | 166 virtual base::Value* ToValue() const OVERRIDE; |
22 | 167 |
23 private: | 168 private: |
24 const std::string file_name_; | 169 const std::string file_name_; |
25 const int64 start_offset_; | 170 const int64 start_offset_; |
(...skipping 24 matching lines...) Expand all Loading... | |
50 private: | 195 private: |
51 const std::string operation_; | 196 const std::string operation_; |
52 const net::Error net_error_; | 197 const net::Error net_error_; |
53 | 198 |
54 DISALLOW_COPY_AND_ASSIGN(FileErrorParameters); | 199 DISALLOW_COPY_AND_ASSIGN(FileErrorParameters); |
55 }; | 200 }; |
56 | 201 |
57 } // namespace download_net_logs | 202 } // namespace download_net_logs |
58 | 203 |
59 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ | 204 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ |
OLD | NEW |