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 "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // Callback invoked after the delegate aquires a path reservation. | 177 // Callback invoked after the delegate aquires a path reservation. |
178 void ReserveVirtualPathDone(const base::FilePath& path, bool verified); | 178 void ReserveVirtualPathDone(const base::FilePath& path, bool verified); |
179 | 179 |
180 // Presents a file picker to the user if necessary. | 180 // Presents a file picker to the user if necessary. |
181 // Next state: | 181 // Next state: |
182 // - STATE_DETERMINE_LOCAL_PATH. | 182 // - STATE_DETERMINE_LOCAL_PATH. |
183 Result DoPromptUserForDownloadPath(); | 183 Result DoPromptUserForDownloadPath(); |
184 | 184 |
185 // Callback invoked after the file picker completes. Cancels the download if | 185 // Callback invoked after the file picker completes. Cancels the download if |
186 // the user cancels the file picker. | 186 // the user cancels the file picker. |
187 void PromptUserForDownloadPathDone(const base::FilePath& virtual_path); | 187 void PromptUserForDownloadPathDone(const base::FilePath& virtual_path, |
| 188 bool hide_file_extension); |
188 | 189 |
189 // Up until this point, the path that was used is considered to be a virtual | 190 // Up until this point, the path that was used is considered to be a virtual |
190 // path. This step determines the local file system path corresponding to this | 191 // path. This step determines the local file system path corresponding to this |
191 // virtual path. The translation is done by invoking the DetermineLocalPath() | 192 // virtual path. The translation is done by invoking the DetermineLocalPath() |
192 // method on the delegate. | 193 // method on the delegate. |
193 // Next state: | 194 // Next state: |
194 // - STATE_DETERMINE_MIME_TYPE. | 195 // - STATE_DETERMINE_MIME_TYPE. |
195 Result DoDetermineLocalPath(); | 196 Result DoDetermineLocalPath(); |
196 | 197 |
197 // Callback invoked when the delegate has determined local path. | 198 // Callback invoked when the delegate has determined local path. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 bool should_notify_extensions_; | 304 bool should_notify_extensions_; |
304 bool create_target_directory_; | 305 bool create_target_directory_; |
305 DownloadPathReservationTracker::FilenameConflictAction conflict_action_; | 306 DownloadPathReservationTracker::FilenameConflictAction conflict_action_; |
306 content::DownloadDangerType danger_type_; | 307 content::DownloadDangerType danger_type_; |
307 bool is_dangerous_file_; // See DownloadTargetInfo::is_dangerous_file | 308 bool is_dangerous_file_; // See DownloadTargetInfo::is_dangerous_file |
308 base::FilePath virtual_path_; | 309 base::FilePath virtual_path_; |
309 base::FilePath local_path_; | 310 base::FilePath local_path_; |
310 base::FilePath intermediate_path_; | 311 base::FilePath intermediate_path_; |
311 std::string mime_type_; | 312 std::string mime_type_; |
312 bool is_filetype_handled_safely_; | 313 bool is_filetype_handled_safely_; |
| 314 bool hide_file_extension_; |
313 | 315 |
314 content::DownloadItem* download_; | 316 content::DownloadItem* download_; |
315 const bool is_resumption_; | 317 const bool is_resumption_; |
316 DownloadPrefs* download_prefs_; | 318 DownloadPrefs* download_prefs_; |
317 DownloadTargetDeterminerDelegate* delegate_; | 319 DownloadTargetDeterminerDelegate* delegate_; |
318 CompletionCallback completion_callback_; | 320 CompletionCallback completion_callback_; |
319 base::CancelableTaskTracker history_tracker_; | 321 base::CancelableTaskTracker history_tracker_; |
320 | 322 |
321 base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_; | 323 base::WeakPtrFactory<DownloadTargetDeterminer> weak_ptr_factory_; |
322 | 324 |
323 DISALLOW_COPY_AND_ASSIGN(DownloadTargetDeterminer); | 325 DISALLOW_COPY_AND_ASSIGN(DownloadTargetDeterminer); |
324 }; | 326 }; |
325 | 327 |
326 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ | 328 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TARGET_DETERMINER_H_ |
OLD | NEW |