OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SAFE_BROWSING_INCIDENT_REPORTING_DOWNLOAD_METADATA_MANAGE
R_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_DOWNLOAD_METADATA_MANAGE
R_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_DOWNLOAD_METADATA_MANAGE
R_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_DOWNLOAD_METADATA_MANAGE
R_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 | 10 |
10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
13 #include "content/public/browser/download_manager.h" | 14 #include "content/public/browser/download_manager.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
17 class SequencedWorkerPool; | 18 class SequencedWorkerPool; |
18 } | 19 } |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 class BrowserContext; | 22 class BrowserContext; |
22 class DownloadItem; | 23 class DownloadItem; |
23 } | 24 } |
24 | 25 |
25 namespace safe_browsing { | 26 namespace safe_browsing { |
26 | 27 |
27 class ClientDownloadRequest; | 28 class ClientDownloadRequest; |
28 class ClientIncidentReport_DownloadDetails; | 29 class ClientIncidentReport_DownloadDetails; |
29 class DownloadMetadata; | 30 class DownloadMetadata; |
30 | 31 |
31 // A browser-wide object that manages the persistent state of metadata | 32 // A browser-wide object that manages the persistent state of metadata |
32 // pertaining to a download. | 33 // pertaining to a download. |
33 class DownloadMetadataManager : public content::DownloadManager::Observer { | 34 class DownloadMetadataManager : public content::DownloadManager::Observer { |
34 public: | 35 public: |
35 // A callback run when the results of a call to GetDownloadDetails are ready. | 36 // A callback run when the results of a call to GetDownloadDetails are ready. |
36 // The supplied parameter may be null, indicating that there are no persisted | 37 // The supplied parameter may be null, indicating that there are no persisted |
37 // details for the |browser_context| passed to GetDownloadDetails. | 38 // details for the |browser_context| passed to GetDownloadDetails. |
38 typedef base::Callback<void(scoped_ptr<ClientIncidentReport_DownloadDetails>)> | 39 typedef base::Callback<void( |
| 40 std::unique_ptr<ClientIncidentReport_DownloadDetails>)> |
39 GetDownloadDetailsCallback; | 41 GetDownloadDetailsCallback; |
40 | 42 |
41 // Constructs a new instance for which disk IO operations will take place in | 43 // Constructs a new instance for which disk IO operations will take place in |
42 // |worker_pool|. | 44 // |worker_pool|. |
43 explicit DownloadMetadataManager( | 45 explicit DownloadMetadataManager( |
44 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); | 46 const scoped_refptr<base::SequencedWorkerPool>& worker_pool); |
45 | 47 |
46 // Constructor that allows tests to provide a specific runner for | 48 // Constructor that allows tests to provide a specific runner for |
47 // asynchronous tasks. | 49 // asynchronous tasks. |
48 explicit DownloadMetadataManager( | 50 explicit DownloadMetadataManager( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Contexts for each DownloadManager that has been added and has not yet | 92 // Contexts for each DownloadManager that has been added and has not yet |
91 // "gone down". | 93 // "gone down". |
92 ManagerToContextMap contexts_; | 94 ManagerToContextMap contexts_; |
93 | 95 |
94 DISALLOW_COPY_AND_ASSIGN(DownloadMetadataManager); | 96 DISALLOW_COPY_AND_ASSIGN(DownloadMetadataManager); |
95 }; | 97 }; |
96 | 98 |
97 } // namespace safe_browsing | 99 } // namespace safe_browsing |
98 | 100 |
99 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_DOWNLOAD_METADATA_MAN
AGER_H_ | 101 #endif // CHROME_BROWSER_SAFE_BROWSING_INCIDENT_REPORTING_DOWNLOAD_METADATA_MAN
AGER_H_ |
OLD | NEW |