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 CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
| 11 #include <utility> |
11 | 12 |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/scoped_observer.h" | 15 #include "base/scoped_observer.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "chrome/browser/download/download_danger_prompt.h" | 17 #include "chrome/browser/download/download_danger_prompt.h" |
17 #include "chrome/browser/download/download_path_reservation_tracker.h" | 18 #include "chrome/browser/download/download_path_reservation_tracker.h" |
| 19 #include "chrome/browser/download/download_query.h" |
18 #include "chrome/browser/extensions/chrome_extension_function.h" | 20 #include "chrome/browser/extensions/chrome_extension_function.h" |
19 #include "chrome/common/extensions/api/downloads.h" | 21 #include "chrome/common/extensions/api/downloads.h" |
20 #include "content/public/browser/all_download_item_notifier.h" | 22 #include "content/public/browser/all_download_item_notifier.h" |
21 #include "content/public/browser/download_manager.h" | 23 #include "content/public/browser/download_manager.h" |
22 #include "extensions/browser/event_router.h" | 24 #include "extensions/browser/event_router.h" |
23 #include "extensions/browser/extension_registry_observer.h" | 25 #include "extensions/browser/extension_registry_observer.h" |
24 #include "extensions/browser/warning_set.h" | 26 #include "extensions/browser/warning_set.h" |
25 | 27 |
26 class DownloadFileIconExtractor; | 28 class DownloadFileIconExtractor; |
27 | 29 |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 base::Time last_checked_removal_; | 399 base::Time last_checked_removal_; |
398 | 400 |
399 // Listen to extension unloaded notifications. | 401 // Listen to extension unloaded notifications. |
400 ScopedObserver<extensions::ExtensionRegistry, | 402 ScopedObserver<extensions::ExtensionRegistry, |
401 extensions::ExtensionRegistryObserver> | 403 extensions::ExtensionRegistryObserver> |
402 extension_registry_observer_; | 404 extension_registry_observer_; |
403 | 405 |
404 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); | 406 DISALLOW_COPY_AND_ASSIGN(ExtensionDownloadsEventRouter); |
405 }; | 407 }; |
406 | 408 |
| 409 using DownloadQueryFilterTypePair = |
| 410 std::pair<const char*, DownloadQuery::FilterType>; |
| 411 using DownloadQuerySortTypePair = |
| 412 std::pair<const char*, DownloadQuery::SortType>; |
| 413 |
| 414 // Finds the given filter/sort type pair for the string, or returns nullptr if |
| 415 // the string was not found. |
| 416 const DownloadQueryFilterTypePair* FindDownloadFilterTypeByString( |
| 417 const char* key); |
| 418 const DownloadQuerySortTypePair* FindDownloadSortTypeByString(const char* key); |
| 419 |
| 420 #if defined(UNIT_TEST) |
| 421 |
| 422 // These functions return the beginning and end of the respective filter and |
| 423 // sort type maps for the purposes of unit testing that the lists are sorted. |
| 424 const DownloadQueryFilterTypePair* DownloadQueryFilterTypeBeginForTest(); |
| 425 const DownloadQueryFilterTypePair* DownloadQueryFilterTypeEndForTest(); |
| 426 const DownloadQuerySortTypePair* DownloadQuerySortTypeBeginForTest(); |
| 427 const DownloadQuerySortTypePair* DownloadQuerySortTypeEndForTest(); |
| 428 |
| 429 #endif // defined(UNIT_TEST); |
| 430 |
407 } // namespace extensions | 431 } // namespace extensions |
408 | 432 |
409 #endif // CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ | 433 #endif // CHROME_BROWSER_EXTENSIONS_API_DOWNLOADS_DOWNLOADS_API_H_ |
OLD | NEW |