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

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: Changes to comments. 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::DownloadDangerType danger_type,
32 content::DownloadItem::SafetyState safety_state,
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 file_name_;
43 const content::DownloadDangerType danger_type_;
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::DownloadDangerType danger_type,
54 content::DownloadItem::SafetyState safety_state);
55 virtual base::Value* ToValue() const OVERRIDE;
56
57 private:
58 const content::DownloadDangerType danger_type_;
59 const content::DownloadItem::SafetyState safety_state_;
60
61 DISALLOW_COPY_AND_ASSIGN(ItemCheckedParameters);
62 };
63
64 // NetLog parameters when a DownloadItem is added to the history database.
65 class ItemInHistoryParameters : public net::NetLog::EventParameters {
66 public:
67 ItemInHistoryParameters(int64 handle);
68 virtual base::Value* ToValue() const OVERRIDE;
69
70 private:
71 const int64 db_handle_;
72
73 DISALLOW_COPY_AND_ASSIGN(ItemInHistoryParameters);
74 };
75
76 // NetLog parameters when a DownloadItem is updated.
77 class ItemUpdatedParameters : public net::NetLog::EventParameters {
78 public:
79 ItemUpdatedParameters(int64 bytes_so_far);
80 virtual base::Value* ToValue() const OVERRIDE;
81
82 private:
83 const int64 bytes_so_far_;
84
85 DISALLOW_COPY_AND_ASSIGN(ItemUpdatedParameters);
86 };
87
88 // NetLog parameters when a DownloadItem is renamed.
89 class ItemRenamedParameters : public net::NetLog::EventParameters {
90 public:
91 ItemRenamedParameters(
92 const std::string& old_filename, const std::string& new_filename);
93 virtual base::Value* ToValue() const OVERRIDE;
94
95 private:
96 const std::string old_filename_;
97 const std::string new_filename_;
98
99 DISALLOW_COPY_AND_ASSIGN(ItemRenamedParameters);
100 };
101
102 // NetLog parameters when a DownloadItem is interrupted.
103 class ItemInterruptedParameters : public net::NetLog::EventParameters {
104 public:
105 ItemInterruptedParameters(InterruptReason reason,
106 int64 bytes_so_far,
107 const std::string& hash_state);
108 virtual base::Value* ToValue() const OVERRIDE;
109
110 private:
111 const InterruptReason reason_;
112 const int64 bytes_so_far_;
113 const std::string hash_state_;
114
115 DISALLOW_COPY_AND_ASSIGN(ItemInterruptedParameters);
116 };
117
118 // NetLog parameters when a DownloadItem is finished.
119 class ItemFinishedParameters : public net::NetLog::EventParameters {
120 public:
121 ItemFinishedParameters(int64 bytes_so_far, const std::string& final_hash);
122 virtual base::Value* ToValue() const OVERRIDE;
123
124 private:
125 const int64 bytes_so_far_;
126 const std::string final_hash_;
127
128 DISALLOW_COPY_AND_ASSIGN(ItemFinishedParameters);
129 };
130
131 // NetLog parameters when a DownloadItem is canceled.
132 class ItemCanceledParameters : public net::NetLog::EventParameters {
133 public:
134 ItemCanceledParameters(int64 bytes_so_far, const std::string& hash_state);
135 virtual base::Value* ToValue() const OVERRIDE;
136
137 private:
138 const int64 bytes_so_far_;
139 const std::string hash_state_;
140
141 DISALLOW_COPY_AND_ASSIGN(ItemCanceledParameters);
142 };
143
16 // NetLog parameters when a DownloadFile is opened. 144 // NetLog parameters when a DownloadFile is opened.
17 class FileOpenedParameters : public net::NetLog::EventParameters { 145 class FileOpenedParameters : public net::NetLog::EventParameters {
18 public: 146 public:
19 FileOpenedParameters(const std::string& file_name, 147 FileOpenedParameters(const std::string& file_name,
20 int64 start_offset); 148 int64 start_offset);
21 virtual base::Value* ToValue() const OVERRIDE; 149 virtual base::Value* ToValue() const OVERRIDE;
22 150
23 private: 151 private:
24 const std::string file_name_; 152 const std::string file_name_;
25 const int64 start_offset_; 153 const int64 start_offset_;
(...skipping 24 matching lines...) Expand all
50 private: 178 private:
51 const std::string operation_; 179 const std::string operation_;
52 const net::Error net_error_; 180 const net::Error net_error_;
53 181
54 DISALLOW_COPY_AND_ASSIGN(FileErrorParameters); 182 DISALLOW_COPY_AND_ASSIGN(FileErrorParameters);
55 }; 183 };
56 184
57 } // namespace download_net_logs 185 } // namespace download_net_logs
58 186
59 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ 187 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/download_net_log_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698