summaryrefslogtreecommitdiff
path: root/chromium/content/browser/download/download_net_log_parameters.h
blob: 2f4b6a006e585bded2bedabe450e2269267b8cd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_
#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_

#include <stddef.h>
#include <stdint.h>

#include <string>

#include "content/public/browser/download_item.h"
#include "net/base/net_errors.h"
#include "net/log/net_log.h"

class GURL;

namespace base {
class FilePath;
}

namespace content {

enum DownloadType {
  SRC_ACTIVE_DOWNLOAD,
  SRC_HISTORY_IMPORT,
  SRC_SAVE_PAGE_AS
};

// Returns NetLog parameters when a DownloadItem is activated.
scoped_ptr<base::Value> ItemActivatedNetLogCallback(
    const DownloadItem* download_item,
    DownloadType download_type,
    const std::string* file_name,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadItem is checked for danger.
scoped_ptr<base::Value> ItemCheckedNetLogCallback(
    DownloadDangerType danger_type,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadItem is renamed.
scoped_ptr<base::Value> ItemRenamedNetLogCallback(
    const base::FilePath* old_filename,
    const base::FilePath* new_filename,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadItem is interrupted.
scoped_ptr<base::Value> ItemInterruptedNetLogCallback(
    DownloadInterruptReason reason,
    int64_t bytes_so_far,
    const std::string* hash_state,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadItem is resumed.
scoped_ptr<base::Value> ItemResumingNetLogCallback(
    bool user_initiated,
    DownloadInterruptReason reason,
    int64_t bytes_so_far,
    const std::string* hash_state,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadItem is completing.
scoped_ptr<base::Value> ItemCompletingNetLogCallback(
    int64_t bytes_so_far,
    const std::string* final_hash,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadItem is finished.
scoped_ptr<base::Value> ItemFinishedNetLogCallback(
    bool auto_opened,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadItem is canceled.
scoped_ptr<base::Value> ItemCanceledNetLogCallback(
    int64_t bytes_so_far,
    const std::string* hash_state,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadFile is opened.
scoped_ptr<base::Value> FileOpenedNetLogCallback(
    const base::FilePath* file_name,
    int64_t start_offset,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadFile is opened.
scoped_ptr<base::Value> FileStreamDrainedNetLogCallback(
    size_t stream_size,
    size_t num_buffers,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a DownloadFile is renamed.
scoped_ptr<base::Value> FileRenamedNetLogCallback(
    const base::FilePath* old_filename,
    const base::FilePath* new_filename,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters when a File has an error.
scoped_ptr<base::Value> FileErrorNetLogCallback(
    const char* operation,
    net::Error net_error,
    net::NetLogCaptureMode capture_mode);

// Returns NetLog parameters for a download interruption.
scoped_ptr<base::Value> FileInterruptedNetLogCallback(
    const char* operation,
    int os_error,
    DownloadInterruptReason reason,
    net::NetLogCaptureMode capture_mode);

}  // namespace content

#endif  // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_