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

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: Changes to comments. Created 8 years, 10 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 031cea039242cc0cf2434a4d945cc96a490cc12d..46e94972cc7cc69e27a0a22b054a70932eaa99aa 100644
--- a/content/browser/download/download_net_log_parameters.h
+++ b/content/browser/download/download_net_log_parameters.h
@@ -8,11 +8,139 @@
#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& file_name,
+ content::DownloadDangerType danger_type,
+ 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 file_name_;
+ const content::DownloadDangerType danger_type_;
+ 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::DownloadDangerType danger_type,
+ content::DownloadItem::SafetyState safety_state);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const content::DownloadDangerType danger_type_;
+ 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);
+ virtual base::Value* ToValue() const OVERRIDE;
+
+ private:
+ const int64 bytes_so_far_;
+
+ 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 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:
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/download_net_log_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698