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

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

Issue 9121053: Added net logging to DownloadItem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk Created 8 years, 10 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) 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& file_name,
31 content::DownloadItem::SafetyState safety_state,
32 int64 start_offset);
33 virtual ~ItemActivatedParameters();
34 virtual base::Value* ToValue() const OVERRIDE;
35
36 private:
37 const DownloadType type_;
38 const int64 id_;
39 const std::string original_url_;
40 const std::string final_url_;
41 const std::string file_name_;
42 const content::DownloadItem::SafetyState safety_state_;
43 const int64 start_offset_;
44
45 DISALLOW_COPY_AND_ASSIGN(ItemActivatedParameters);
46 };
47
48 // NetLog parameters when a DownloadItem is checked for danger.
49 class ItemCheckedParameters : public net::NetLog::EventParameters {
50 public:
51 ItemCheckedParameters(content::DownloadItem::SafetyState safety_state);
52 virtual base::Value* ToValue() const OVERRIDE;
53
54 private:
55 const content::DownloadItem::SafetyState safety_state_;
56
57 DISALLOW_COPY_AND_ASSIGN(ItemCheckedParameters);
58 };
59
60 // NetLog parameters when a DownloadItem is added to the history database.
61 class ItemInHistoryParameters : public net::NetLog::EventParameters {
62 public:
63 ItemInHistoryParameters(int64 handle);
64 virtual base::Value* ToValue() const OVERRIDE;
65
66 private:
67 const int64 db_handle_;
68
69 DISALLOW_COPY_AND_ASSIGN(ItemInHistoryParameters);
70 };
71
72 // NetLog parameters when a DownloadItem is updated.
73 class ItemUpdatedParameters : public net::NetLog::EventParameters {
74 public:
75 ItemUpdatedParameters(int64 bytes_so_far);
76 virtual base::Value* ToValue() const OVERRIDE;
77
78 private:
79 const int64 bytes_so_far_;
80
81 DISALLOW_COPY_AND_ASSIGN(ItemUpdatedParameters);
82 };
83
84 // NetLog parameters when a DownloadItem is renamed.
85 class ItemRenamedParameters : public net::NetLog::EventParameters {
86 public:
87 ItemRenamedParameters(
88 const std::string& old_filename, const std::string& new_filename);
89 virtual base::Value* ToValue() const OVERRIDE;
90
91 private:
92 const std::string old_filename_;
93 const std::string new_filename_;
94
95 DISALLOW_COPY_AND_ASSIGN(ItemRenamedParameters);
96 };
97
98 // NetLog parameters when a DownloadItem is interrupted.
99 class ItemInterruptedParameters : public net::NetLog::EventParameters {
100 public:
101 ItemInterruptedParameters(InterruptReason reason,
102 int64 bytes_so_far,
103 const std::string& hash_state);
104 virtual base::Value* ToValue() const OVERRIDE;
105
106 private:
107 const InterruptReason reason_;
108 const int64 bytes_so_far_;
109 const std::string hash_state_;
110
111 DISALLOW_COPY_AND_ASSIGN(ItemInterruptedParameters);
112 };
113
114 // NetLog parameters when a DownloadItem is finished.
115 class ItemFinishedParameters : public net::NetLog::EventParameters {
116 public:
117 ItemFinishedParameters(int64 bytes_so_far, const std::string& final_hash);
118 virtual base::Value* ToValue() const OVERRIDE;
119
120 private:
121 const int64 bytes_so_far_;
122 const std::string final_hash_;
123
124 DISALLOW_COPY_AND_ASSIGN(ItemFinishedParameters);
125 };
126
127 // NetLog parameters when a DownloadItem is canceled.
128 class ItemCanceledParameters : public net::NetLog::EventParameters {
129 public:
130 ItemCanceledParameters(int64 bytes_so_far, const std::string& hash_state);
131 virtual base::Value* ToValue() const OVERRIDE;
132
133 private:
134 const int64 bytes_so_far_;
135 const std::string hash_state_;
136
137 DISALLOW_COPY_AND_ASSIGN(ItemCanceledParameters);
138 };
139
16 // NetLog parameters when a DownloadFile is opened. 140 // NetLog parameters when a DownloadFile is opened.
17 class FileOpenedParameters : public net::NetLog::EventParameters { 141 class FileOpenedParameters : public net::NetLog::EventParameters {
18 public: 142 public:
19 FileOpenedParameters(const std::string& file_name, 143 FileOpenedParameters(const std::string& file_name,
20 int64 start_offset); 144 int64 start_offset);
21 virtual base::Value* ToValue() const OVERRIDE; 145 virtual base::Value* ToValue() const OVERRIDE;
22 146
23 private: 147 private:
24 const std::string file_name_; 148 const std::string file_name_;
25 const int64 start_offset_; 149 const int64 start_offset_;
(...skipping 24 matching lines...) Expand all
50 private: 174 private:
51 const std::string operation_; 175 const std::string operation_;
52 const net::Error net_error_; 176 const net::Error net_error_;
53 177
54 DISALLOW_COPY_AND_ASSIGN(FileErrorParameters); 178 DISALLOW_COPY_AND_ASSIGN(FileErrorParameters);
55 }; 179 };
56 180
57 } // namespace download_net_logs 181 } // namespace download_net_logs
58 182
59 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ 183 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698