Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / download / download_net_log_parameters.h
blob6e103bdff5f0991b1eabc53ac553794e1a58df47
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_
8 #include <string>
10 #include "content/public/browser/download_item.h"
11 #include "net/base/net_errors.h"
12 #include "net/log/net_log.h"
14 class GURL;
16 namespace base {
17 class FilePath;
20 namespace content {
22 enum DownloadType {
23 SRC_ACTIVE_DOWNLOAD,
24 SRC_HISTORY_IMPORT,
25 SRC_SAVE_PAGE_AS
28 // Returns NetLog parameters when a DownloadItem is activated.
29 scoped_ptr<base::Value> ItemActivatedNetLogCallback(
30 const DownloadItem* download_item,
31 DownloadType download_type,
32 const std::string* file_name,
33 net::NetLogCaptureMode capture_mode);
35 // Returns NetLog parameters when a DownloadItem is checked for danger.
36 scoped_ptr<base::Value> ItemCheckedNetLogCallback(
37 DownloadDangerType danger_type,
38 net::NetLogCaptureMode capture_mode);
40 // Returns NetLog parameters when a DownloadItem is renamed.
41 scoped_ptr<base::Value> ItemRenamedNetLogCallback(
42 const base::FilePath* old_filename,
43 const base::FilePath* new_filename,
44 net::NetLogCaptureMode capture_mode);
46 // Returns NetLog parameters when a DownloadItem is interrupted.
47 scoped_ptr<base::Value> ItemInterruptedNetLogCallback(
48 DownloadInterruptReason reason,
49 int64 bytes_so_far,
50 const std::string* hash_state,
51 net::NetLogCaptureMode capture_mode);
53 // Returns NetLog parameters when a DownloadItem is resumed.
54 scoped_ptr<base::Value> ItemResumingNetLogCallback(
55 bool user_initiated,
56 DownloadInterruptReason reason,
57 int64 bytes_so_far,
58 const std::string* hash_state,
59 net::NetLogCaptureMode capture_mode);
61 // Returns NetLog parameters when a DownloadItem is completing.
62 scoped_ptr<base::Value> ItemCompletingNetLogCallback(
63 int64 bytes_so_far,
64 const std::string* final_hash,
65 net::NetLogCaptureMode capture_mode);
67 // Returns NetLog parameters when a DownloadItem is finished.
68 scoped_ptr<base::Value> ItemFinishedNetLogCallback(
69 bool auto_opened,
70 net::NetLogCaptureMode capture_mode);
72 // Returns NetLog parameters when a DownloadItem is canceled.
73 scoped_ptr<base::Value> ItemCanceledNetLogCallback(
74 int64 bytes_so_far,
75 const std::string* hash_state,
76 net::NetLogCaptureMode capture_mode);
78 // Returns NetLog parameters when a DownloadFile is opened.
79 scoped_ptr<base::Value> FileOpenedNetLogCallback(
80 const base::FilePath* file_name,
81 int64 start_offset,
82 net::NetLogCaptureMode capture_mode);
84 // Returns NetLog parameters when a DownloadFile is opened.
85 scoped_ptr<base::Value> FileStreamDrainedNetLogCallback(
86 size_t stream_size,
87 size_t num_buffers,
88 net::NetLogCaptureMode capture_mode);
90 // Returns NetLog parameters when a DownloadFile is renamed.
91 scoped_ptr<base::Value> FileRenamedNetLogCallback(
92 const base::FilePath* old_filename,
93 const base::FilePath* new_filename,
94 net::NetLogCaptureMode capture_mode);
96 // Returns NetLog parameters when a File has an error.
97 scoped_ptr<base::Value> FileErrorNetLogCallback(
98 const char* operation,
99 net::Error net_error,
100 net::NetLogCaptureMode capture_mode);
102 // Returns NetLog parameters for a download interruption.
103 scoped_ptr<base::Value> FileInterruptedNetLogCallback(
104 const char* operation,
105 int os_error,
106 DownloadInterruptReason reason,
107 net::NetLogCaptureMode capture_mode);
109 } // namespace content
111 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_