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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "content/public/browser/download_item.h" | 10 #include "content/public/browser/download_item.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "net/log/net_log.h" | 12 #include "net/log/net_log.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class FilePath; | 17 class FilePath; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 enum DownloadType { | 22 enum DownloadType { |
23 SRC_ACTIVE_DOWNLOAD, | 23 SRC_ACTIVE_DOWNLOAD, |
24 SRC_HISTORY_IMPORT, | 24 SRC_HISTORY_IMPORT, |
25 SRC_SAVE_PAGE_AS | 25 SRC_SAVE_PAGE_AS |
26 }; | 26 }; |
27 | 27 |
28 // Returns NetLog parameters when a DownloadItem is activated. | 28 // Returns NetLog parameters when a DownloadItem is activated. |
29 base::Value* ItemActivatedNetLogCallback( | 29 base::Value* ItemActivatedNetLogCallback(const DownloadItem* download_item, |
30 const DownloadItem* download_item, | 30 DownloadType download_type, |
31 DownloadType download_type, | 31 const std::string* file_name, |
32 const std::string* file_name, | 32 net::NetLogCaptureMode capture_mode); |
33 net::NetLog::LogLevel log_level); | |
34 | 33 |
35 // Returns NetLog parameters when a DownloadItem is checked for danger. | 34 // Returns NetLog parameters when a DownloadItem is checked for danger. |
36 base::Value* ItemCheckedNetLogCallback( | 35 base::Value* ItemCheckedNetLogCallback(DownloadDangerType danger_type, |
37 DownloadDangerType danger_type, | 36 net::NetLogCaptureMode capture_mode); |
38 net::NetLog::LogLevel log_level); | |
39 | 37 |
40 // Returns NetLog parameters when a DownloadItem is renamed. | 38 // Returns NetLog parameters when a DownloadItem is renamed. |
41 base::Value* ItemRenamedNetLogCallback(const base::FilePath* old_filename, | 39 base::Value* ItemRenamedNetLogCallback(const base::FilePath* old_filename, |
42 const base::FilePath* new_filename, | 40 const base::FilePath* new_filename, |
43 net::NetLog::LogLevel log_level); | 41 net::NetLogCaptureMode capture_mode); |
44 | 42 |
45 // Returns NetLog parameters when a DownloadItem is interrupted. | 43 // Returns NetLog parameters when a DownloadItem is interrupted. |
46 base::Value* ItemInterruptedNetLogCallback(DownloadInterruptReason reason, | 44 base::Value* ItemInterruptedNetLogCallback(DownloadInterruptReason reason, |
47 int64 bytes_so_far, | 45 int64 bytes_so_far, |
48 const std::string* hash_state, | 46 const std::string* hash_state, |
49 net::NetLog::LogLevel log_level); | 47 net::NetLogCaptureMode capture_mode); |
50 | 48 |
51 // Returns NetLog parameters when a DownloadItem is resumed. | 49 // Returns NetLog parameters when a DownloadItem is resumed. |
52 base::Value* ItemResumingNetLogCallback(bool user_initiated, | 50 base::Value* ItemResumingNetLogCallback(bool user_initiated, |
53 DownloadInterruptReason reason, | 51 DownloadInterruptReason reason, |
54 int64 bytes_so_far, | 52 int64 bytes_so_far, |
55 const std::string* hash_state, | 53 const std::string* hash_state, |
56 net::NetLog::LogLevel log_level); | 54 net::NetLogCaptureMode capture_mode); |
57 | 55 |
58 // Returns NetLog parameters when a DownloadItem is completing. | 56 // Returns NetLog parameters when a DownloadItem is completing. |
59 base::Value* ItemCompletingNetLogCallback(int64 bytes_so_far, | 57 base::Value* ItemCompletingNetLogCallback(int64 bytes_so_far, |
60 const std::string* final_hash, | 58 const std::string* final_hash, |
61 net::NetLog::LogLevel log_level); | 59 net::NetLogCaptureMode capture_mode); |
62 | 60 |
63 // Returns NetLog parameters when a DownloadItem is finished. | 61 // Returns NetLog parameters when a DownloadItem is finished. |
64 base::Value* ItemFinishedNetLogCallback(bool auto_opened, | 62 base::Value* ItemFinishedNetLogCallback(bool auto_opened, |
65 net::NetLog::LogLevel log_level); | 63 net::NetLogCaptureMode capture_mode); |
66 | 64 |
67 // Returns NetLog parameters when a DownloadItem is canceled. | 65 // Returns NetLog parameters when a DownloadItem is canceled. |
68 base::Value* ItemCanceledNetLogCallback(int64 bytes_so_far, | 66 base::Value* ItemCanceledNetLogCallback(int64 bytes_so_far, |
69 const std::string* hash_state, | 67 const std::string* hash_state, |
70 net::NetLog::LogLevel log_level); | 68 net::NetLogCaptureMode capture_mode); |
71 | 69 |
72 // Returns NetLog parameters when a DownloadFile is opened. | 70 // Returns NetLog parameters when a DownloadFile is opened. |
73 base::Value* FileOpenedNetLogCallback(const base::FilePath* file_name, | 71 base::Value* FileOpenedNetLogCallback(const base::FilePath* file_name, |
74 int64 start_offset, | 72 int64 start_offset, |
75 net::NetLog::LogLevel log_level); | 73 net::NetLogCaptureMode capture_mode); |
76 | 74 |
77 // Returns NetLog parameters when a DownloadFile is opened. | 75 // Returns NetLog parameters when a DownloadFile is opened. |
78 base::Value* FileStreamDrainedNetLogCallback(size_t stream_size, | 76 base::Value* FileStreamDrainedNetLogCallback( |
79 size_t num_buffers, | 77 size_t stream_size, |
80 net::NetLog::LogLevel log_level); | 78 size_t num_buffers, |
| 79 net::NetLogCaptureMode capture_mode); |
81 | 80 |
82 // Returns NetLog parameters when a DownloadFile is renamed. | 81 // Returns NetLog parameters when a DownloadFile is renamed. |
83 base::Value* FileRenamedNetLogCallback(const base::FilePath* old_filename, | 82 base::Value* FileRenamedNetLogCallback(const base::FilePath* old_filename, |
84 const base::FilePath* new_filename, | 83 const base::FilePath* new_filename, |
85 net::NetLog::LogLevel log_level); | 84 net::NetLogCaptureMode capture_mode); |
86 | 85 |
87 // Returns NetLog parameters when a File has an error. | 86 // Returns NetLog parameters when a File has an error. |
88 base::Value* FileErrorNetLogCallback(const char* operation, | 87 base::Value* FileErrorNetLogCallback(const char* operation, |
89 net::Error net_error, | 88 net::Error net_error, |
90 net::NetLog::LogLevel log_level); | 89 net::NetLogCaptureMode capture_mode); |
91 | 90 |
92 // Returns NetLog parameters for a download interruption. | 91 // Returns NetLog parameters for a download interruption. |
93 base::Value* FileInterruptedNetLogCallback(const char* operation, | 92 base::Value* FileInterruptedNetLogCallback(const char* operation, |
94 int os_error, | 93 int os_error, |
95 DownloadInterruptReason reason, | 94 DownloadInterruptReason reason, |
96 net::NetLog::LogLevel log_level); | 95 net::NetLogCaptureMode capture_mode); |
97 | 96 |
98 } // namespace content | 97 } // namespace content |
99 | 98 |
100 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ | 99 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ |
OLD | NEW |