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

Unified 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: Merged with parent. Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_net_log_parameters.h
diff --git a/content/browser/download/download_net_log_parameters.h b/content/browser/download/download_net_log_parameters.h
index 5eae8823176f286239d04c05b409df08111072b1..12a8874ea28d9a5ed93c307500aef01a6767281e 100644
--- a/content/browser/download/download_net_log_parameters.h
+++ b/content/browser/download/download_net_log_parameters.h
@@ -8,11 +8,156 @@
#include <string>
+#include "content/public/browser/download_item.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
namespace download_net_logs {
+enum DownloadType {
+ SRC_NEW_DOWNLOAD,
+ SRC_HISTORY_IMPORT,
+ SRC_SAVE_PAGE_AS
+};
+
+// NetLog parameters when a DownloadItem is activated.
+class ItemActivatedParameters : public net::NetLog::EventParameters {
+ public:
+ ItemActivatedParameters(DownloadType download_type,
+ int64 id,
+ const std::string& original_url,
+ const std::string& final_url,
+ const std::string& intermediate_name,
+ const std::string& suggested_name,
+ content::DownloadItem::SafetyState safety_state,
+ int64 start_offset);
+ virtual ~ItemActivatedParameters();
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const DownloadType type_;
+ const int64 id_;
+ const std::string original_url_;
+ const std::string final_url_;
+ const std::string intermediate_filename_;
+ const std::string suggested_final_filename_;
+ const content::DownloadItem::SafetyState safety_state_;
+ const int64 start_offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemActivatedParameters);
+};
+
+// NetLog parameters when a DownloadItem is checked for danger.
+class ItemCheckedParameters : public net::NetLog::EventParameters {
+ public:
+ ItemCheckedParameters(content::DownloadItem::SafetyState safety_state);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const content::DownloadItem::SafetyState safety_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemCheckedParameters);
+};
+
+// NetLog parameters when a DownloadItem is added to the history database.
+class ItemInHistoryParameters : public net::NetLog::EventParameters {
+ public:
+ ItemInHistoryParameters(int64 handle);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const int64 db_handle_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemInHistoryParameters);
+};
+
+// NetLog parameters when a DownloadItem is updated.
+class ItemUpdatedParameters : public net::NetLog::EventParameters {
+ public:
+ ItemUpdatedParameters(int64 bytes_so_far, const std::string& hash_state);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const int64 bytes_so_far_;
+ const std::string hash_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemUpdatedParameters);
+};
+
+// NetLog parameters when a DownloadItem is renamed.
+class ItemRenamedParameters : public net::NetLog::EventParameters {
+ public:
+ ItemRenamedParameters(
+ const std::string& old_filename, const std::string& new_filename);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const std::string old_filename_;
+ const std::string new_filename_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemRenamedParameters);
+};
+
+// NetLog parameters when a DownloadItem is interrupted.
+class ItemInterruptedParameters : public net::NetLog::EventParameters {
+ public:
+ ItemInterruptedParameters(InterruptReason reason,
+ int64 bytes_so_far,
+ const std::string& hash_state);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const InterruptReason reason_;
+ const int64 bytes_so_far_;
+ const std::string hash_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemInterruptedParameters);
+};
+
+// NetLog parameters when a DownloadItem is resumed.
+class ItemResumedParameters : public net::NetLog::EventParameters {
+ public:
+ ItemResumedParameters(bool user_initiated,
+ InterruptReason reason,
+ int64 bytes_so_far,
+ const std::string& hash_state);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const bool user_initiated_;
+ const InterruptReason reason_;
+ const int64 bytes_so_far_;
+ const std::string hash_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemResumedParameters);
+};
+
+// NetLog parameters when a DownloadItem is finished.
+class ItemFinishedParameters : public net::NetLog::EventParameters {
+ public:
+ ItemFinishedParameters(int64 bytes_so_far, const std::string& final_hash);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const int64 bytes_so_far_;
+ const std::string final_hash_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemFinishedParameters);
+};
+
+// NetLog parameters when a DownloadItem is canceled.
+class ItemCanceledParameters : public net::NetLog::EventParameters {
+ public:
+ ItemCanceledParameters(int64 bytes_so_far, const std::string& hash_state);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const int64 bytes_so_far_;
+ const std::string hash_state_;
+
+ DISALLOW_COPY_AND_ASSIGN(ItemCanceledParameters);
+};
+
// NetLog parameters when a DownloadFile is opened.
class FileOpenedParameters : public net::NetLog::EventParameters {
public:

Powered by Google App Engine
This is Rietveld 408576698