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

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api.h

Issue 2956213003: Statically allocate extension download lookups. (Closed)
Patch Set: Better tests Created 3 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/downloads/downloads_api.h
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.h b/chrome/browser/extensions/api/downloads/downloads_api.h
index a2533258801deec138ac611f2d4c31c119ee3dfe..279b3be57a47eb207b4a5de607df8b23ac72e435 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api.h
+++ b/chrome/browser/extensions/api/downloads/downloads_api.h
@@ -8,6 +8,7 @@
#include <memory>
#include <set>
#include <string>
+#include <utility>
#include "base/files/file_path.h"
#include "base/macros.h"
@@ -15,6 +16,7 @@
#include "base/time/time.h"
#include "chrome/browser/download/download_danger_prompt.h"
#include "chrome/browser/download/download_path_reservation_tracker.h"
+#include "chrome/browser/download/download_query.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/common/extensions/api/downloads.h"
#include "content/public/browser/all_download_item_notifier.h"
@@ -404,6 +406,28 @@ class ExtensionDownloadsEventRouter
DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter);
};
+using DownloadQueryFilterTypePair =
+ std::pair<const char*, DownloadQuery::FilterType>;
+using DownloadQuerySortTypePair =
+ std::pair<const char*, DownloadQuery::SortType>;
+
+// Finds the given filter/sort type pair for the string, or returns nullptr if
+// the string was not found.
+const DownloadQueryFilterTypePair* FindDownloadFilterTypeByString(
+ const char* key);
+const DownloadQuerySortTypePair* FindDownloadSortTypeByString(const char* key);
+
+#if defined(UNIT_TEST)
+
+// These functions return the beginning and end of the respective filter and
+// sort type maps for the purposes of unit testing that the lists are sorted.
+const DownloadQueryFilterTypePair* DownloadQueryFilterTypeBeginForTest();
+const DownloadQueryFilterTypePair* DownloadQueryFilterTypeEndForTest();
+const DownloadQuerySortTypePair* DownloadQuerySortTypeBeginForTest();
+const DownloadQuerySortTypePair* DownloadQuerySortTypeEndForTest();
+
+#endif // defined(UNIT_TEST);
+
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698