| 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(const DownloadItem* download_item, | 29 scoped_ptr<base::Value> ItemActivatedNetLogCallback( |
| 30 DownloadType download_type, | 30 const DownloadItem* download_item, |
| 31 const std::string* file_name, | 31 DownloadType download_type, |
| 32 net::NetLogCaptureMode capture_mode); | 32 const std::string* file_name, |
| 33 net::NetLogCaptureMode capture_mode); |
| 33 | 34 |
| 34 // Returns NetLog parameters when a DownloadItem is checked for danger. | 35 // Returns NetLog parameters when a DownloadItem is checked for danger. |
| 35 base::Value* ItemCheckedNetLogCallback(DownloadDangerType danger_type, | 36 scoped_ptr<base::Value> ItemCheckedNetLogCallback( |
| 36 net::NetLogCaptureMode capture_mode); | 37 DownloadDangerType danger_type, |
| 38 net::NetLogCaptureMode capture_mode); |
| 37 | 39 |
| 38 // Returns NetLog parameters when a DownloadItem is renamed. | 40 // Returns NetLog parameters when a DownloadItem is renamed. |
| 39 base::Value* ItemRenamedNetLogCallback(const base::FilePath* old_filename, | 41 scoped_ptr<base::Value> ItemRenamedNetLogCallback( |
| 40 const base::FilePath* new_filename, | 42 const base::FilePath* old_filename, |
| 41 net::NetLogCaptureMode capture_mode); | 43 const base::FilePath* new_filename, |
| 44 net::NetLogCaptureMode capture_mode); |
| 42 | 45 |
| 43 // Returns NetLog parameters when a DownloadItem is interrupted. | 46 // Returns NetLog parameters when a DownloadItem is interrupted. |
| 44 base::Value* ItemInterruptedNetLogCallback(DownloadInterruptReason reason, | 47 scoped_ptr<base::Value> ItemInterruptedNetLogCallback( |
| 45 int64 bytes_so_far, | 48 DownloadInterruptReason reason, |
| 46 const std::string* hash_state, | 49 int64 bytes_so_far, |
| 47 net::NetLogCaptureMode capture_mode); | 50 const std::string* hash_state, |
| 51 net::NetLogCaptureMode capture_mode); |
| 48 | 52 |
| 49 // Returns NetLog parameters when a DownloadItem is resumed. | 53 // Returns NetLog parameters when a DownloadItem is resumed. |
| 50 base::Value* ItemResumingNetLogCallback(bool user_initiated, | 54 scoped_ptr<base::Value> ItemResumingNetLogCallback( |
| 51 DownloadInterruptReason reason, | 55 bool user_initiated, |
| 52 int64 bytes_so_far, | 56 DownloadInterruptReason reason, |
| 53 const std::string* hash_state, | 57 int64 bytes_so_far, |
| 54 net::NetLogCaptureMode capture_mode); | 58 const std::string* hash_state, |
| 59 net::NetLogCaptureMode capture_mode); |
| 55 | 60 |
| 56 // Returns NetLog parameters when a DownloadItem is completing. | 61 // Returns NetLog parameters when a DownloadItem is completing. |
| 57 base::Value* ItemCompletingNetLogCallback(int64 bytes_so_far, | 62 scoped_ptr<base::Value> ItemCompletingNetLogCallback( |
| 58 const std::string* final_hash, | 63 int64 bytes_so_far, |
| 59 net::NetLogCaptureMode capture_mode); | 64 const std::string* final_hash, |
| 65 net::NetLogCaptureMode capture_mode); |
| 60 | 66 |
| 61 // Returns NetLog parameters when a DownloadItem is finished. | 67 // Returns NetLog parameters when a DownloadItem is finished. |
| 62 base::Value* ItemFinishedNetLogCallback(bool auto_opened, | 68 scoped_ptr<base::Value> ItemFinishedNetLogCallback( |
| 63 net::NetLogCaptureMode capture_mode); | 69 bool auto_opened, |
| 70 net::NetLogCaptureMode capture_mode); |
| 64 | 71 |
| 65 // Returns NetLog parameters when a DownloadItem is canceled. | 72 // Returns NetLog parameters when a DownloadItem is canceled. |
| 66 base::Value* ItemCanceledNetLogCallback(int64 bytes_so_far, | 73 scoped_ptr<base::Value> ItemCanceledNetLogCallback( |
| 67 const std::string* hash_state, | 74 int64 bytes_so_far, |
| 68 net::NetLogCaptureMode capture_mode); | 75 const std::string* hash_state, |
| 76 net::NetLogCaptureMode capture_mode); |
| 69 | 77 |
| 70 // Returns NetLog parameters when a DownloadFile is opened. | 78 // Returns NetLog parameters when a DownloadFile is opened. |
| 71 base::Value* FileOpenedNetLogCallback(const base::FilePath* file_name, | 79 scoped_ptr<base::Value> FileOpenedNetLogCallback( |
| 72 int64 start_offset, | 80 const base::FilePath* file_name, |
| 73 net::NetLogCaptureMode capture_mode); | 81 int64 start_offset, |
| 82 net::NetLogCaptureMode capture_mode); |
| 74 | 83 |
| 75 // Returns NetLog parameters when a DownloadFile is opened. | 84 // Returns NetLog parameters when a DownloadFile is opened. |
| 76 base::Value* FileStreamDrainedNetLogCallback( | 85 scoped_ptr<base::Value> FileStreamDrainedNetLogCallback( |
| 77 size_t stream_size, | 86 size_t stream_size, |
| 78 size_t num_buffers, | 87 size_t num_buffers, |
| 79 net::NetLogCaptureMode capture_mode); | 88 net::NetLogCaptureMode capture_mode); |
| 80 | 89 |
| 81 // Returns NetLog parameters when a DownloadFile is renamed. | 90 // Returns NetLog parameters when a DownloadFile is renamed. |
| 82 base::Value* FileRenamedNetLogCallback(const base::FilePath* old_filename, | 91 scoped_ptr<base::Value> FileRenamedNetLogCallback( |
| 83 const base::FilePath* new_filename, | 92 const base::FilePath* old_filename, |
| 84 net::NetLogCaptureMode capture_mode); | 93 const base::FilePath* new_filename, |
| 94 net::NetLogCaptureMode capture_mode); |
| 85 | 95 |
| 86 // Returns NetLog parameters when a File has an error. | 96 // Returns NetLog parameters when a File has an error. |
| 87 base::Value* FileErrorNetLogCallback(const char* operation, | 97 scoped_ptr<base::Value> FileErrorNetLogCallback( |
| 88 net::Error net_error, | 98 const char* operation, |
| 89 net::NetLogCaptureMode capture_mode); | 99 net::Error net_error, |
| 100 net::NetLogCaptureMode capture_mode); |
| 90 | 101 |
| 91 // Returns NetLog parameters for a download interruption. | 102 // Returns NetLog parameters for a download interruption. |
| 92 base::Value* FileInterruptedNetLogCallback(const char* operation, | 103 scoped_ptr<base::Value> FileInterruptedNetLogCallback( |
| 93 int os_error, | 104 const char* operation, |
| 94 DownloadInterruptReason reason, | 105 int os_error, |
| 95 net::NetLogCaptureMode capture_mode); | 106 DownloadInterruptReason reason, |
| 107 net::NetLogCaptureMode capture_mode); |
| 96 | 108 |
| 97 } // namespace content | 109 } // namespace content |
| 98 | 110 |
| 99 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ | 111 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_NET_LOG_PARAMETERS_H_ |
| OLD | NEW |