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

Unified Diff: components/history/content/browser/download_constants_utils.h

Issue 833033002: Remove dependency on //content from history DownloadDatabase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing conversion Created 5 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: components/history/content/browser/download_constants_utils.h
diff --git a/components/history/content/browser/download_constants_utils.h b/components/history/content/browser/download_constants_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..2529dc78201c33ebeeebbb705815471e9b2672af
--- /dev/null
+++ b/components/history/content/browser/download_constants_utils.h
@@ -0,0 +1,47 @@
+// Copyright 2015 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 COMPONENTS_HISTORY_CONTENT_BROWSER_DOWNLOAD_CONSTANTS_UTILS_H_
+#define COMPONENTS_HISTORY_CONTENT_BROWSER_DOWNLOAD_CONSTANTS_UTILS_H_
+
+#include <string>
+
+#include "components/history/core/browser/download_types.h"
+#include "content/public/browser/download_danger_type.h"
+#include "content/public/browser/download_interrupt_reasons.h"
+#include "content/public/browser/download_item.h"
+
+namespace history {
+
+// Utility functions to convert between content::DownloadItem::DownloadState
+// enumeration and history::DownloadState constants.
+content::DownloadItem::DownloadState ToContentDownloadState(
+ DownloadState state);
+DownloadState ToHistoryDownloadState(
+ content::DownloadItem::DownloadState state);
+
+// Utility functions to convert between content::DownloadDangerType enumeration
+// and history::DownloadDangerType constants.
+content::DownloadDangerType ToContentDownloadDangerType(
+ DownloadDangerType danger_type);
+DownloadDangerType ToHistoryDownloadDangerType(
+ content::DownloadDangerType danger_type);
+
+// Utility functions to convert between content::DownloadInterrupReason
+// enumeration and history::DownloadInterruptReason type (value have no
+// meaning in history, but have a different type to avoid bugs due to
+// implicit conversions).
+content::DownloadInterruptReason ToContentDownloadInterruptReason(
+ DownloadInterruptReason interrupt_reason);
+DownloadInterruptReason ToHistoryDownloadInterruptReason(
+ content::DownloadInterruptReason interrupt_reason);
+
+// Utility functions to convert between content download id values and
+// history::DownloadId type (value have no meaning in history, except
+// for kInvalidDownloadId).
+uint32 ToContentDownloadId(DownloadId id);
+DownloadId ToHistoryDownloadId(uint32 id);
+} // namespace history
+
+#endif // COMPONENTS_HISTORY_CONTENT_BROWSER_DOWNLOAD_CONSTANTS_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698