OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/task/cancelable_task_tracker.h" | 14 #include "base/task/cancelable_task_tracker.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/download/download_path_reservation_tracker.h" | 16 #include "chrome/browser/download/download_path_reservation_tracker.h" |
17 #include "chrome/browser/download/download_target_determiner_delegate.h" | 17 #include "chrome/browser/download/download_target_determiner_delegate.h" |
18 #include "chrome/browser/download/download_target_info.h" | 18 #include "chrome/browser/download/download_target_info.h" |
19 #include "chrome/common/safe_browsing/download_file_types.pb.h" | 19 #include "chrome/common/safe_browsing/download_file_types.pb.h" |
20 #include "content/public/browser/download_danger_type.h" | 20 #include "content/public/browser/download_danger_type.h" |
21 #include "content/public/browser/download_item.h" | 21 #include "content/public/browser/download_item.h" |
22 #include "content/public/browser/download_manager_delegate.h" | 22 #include "content/public/browser/download_manager_delegate.h" |
| 23 #include "ppapi/features/features.h" |
23 | 24 |
24 class ChromeDownloadManagerDelegate; | 25 class ChromeDownloadManagerDelegate; |
25 class Profile; | 26 class Profile; |
26 class DownloadPrefs; | 27 class DownloadPrefs; |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 enum DownloadDangerType; | 30 enum DownloadDangerType; |
30 } | 31 } |
31 | 32 |
32 // Determines the target of the download. | 33 // Determines the target of the download. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Callback invoked when the MIME type is available. Since determination of | 214 // Callback invoked when the MIME type is available. Since determination of |
214 // the MIME type can involve disk access, it is done in the blocking pool. | 215 // the MIME type can involve disk access, it is done in the blocking pool. |
215 void DetermineMimeTypeDone(const std::string& mime_type); | 216 void DetermineMimeTypeDone(const std::string& mime_type); |
216 | 217 |
217 // Determine if the file type can be handled safely by the browser if it were | 218 // Determine if the file type can be handled safely by the browser if it were |
218 // to be opened via a file:// URL. | 219 // to be opened via a file:// URL. |
219 // Next state: | 220 // Next state: |
220 // - STATE_DETERMINE_IF_ADOBE_READER_UP_TO_DATE. | 221 // - STATE_DETERMINE_IF_ADOBE_READER_UP_TO_DATE. |
221 Result DoDetermineIfHandledSafely(); | 222 Result DoDetermineIfHandledSafely(); |
222 | 223 |
223 #if defined(ENABLE_PLUGINS) | 224 #if BUILDFLAG(ENABLE_PLUGINS) |
224 // Callback invoked when a decision is available about whether the file type | 225 // Callback invoked when a decision is available about whether the file type |
225 // can be handled safely by the browser. | 226 // can be handled safely by the browser. |
226 void DetermineIfHandledSafelyDone(bool is_handled_safely); | 227 void DetermineIfHandledSafelyDone(bool is_handled_safely); |
227 #endif | 228 #endif |
228 | 229 |
229 // Determine if Adobe Reader is up to date. Only do the check on Windows for | 230 // Determine if Adobe Reader is up to date. Only do the check on Windows for |
230 // .pdf file targets. | 231 // .pdf file targets. |
231 // Next state: | 232 // Next state: |
232 // - STATE_CHECK_DOWNLOAD_URL. | 233 // - STATE_CHECK_DOWNLOAD_URL. |
233 Result DoDetermineIfAdobeReaderUpToDate(); | 234 Result DoDetermineIfAdobeReaderUpToDate(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 DownloadTargetDeterminerDelegate* delegate_; | 326 DownloadTargetDeterminerDelegate* delegate_; |
326 CompletionCallback completion_callback_; | 327 CompletionCallback completion_callback_; |
327 base::CancelableTaskTracker history_tracker_; | 328 base::CancelableTaskTracker history_tracker_; |
328 | 329 |
329 base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_; | 330 base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_; |
330 | 331 |
331 DISALLOW_COPY_AND_ASSIGN(DownloadTargetDeterminer); | 332 DISALLOW_COPY_AND_ASSIGN(DownloadTargetDeterminer); |
332 }; | 333 }; |
333 | 334 |
334 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ | 335 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ |
OLD | NEW |