| 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 #include "content/shell/browser/shell_download_manager_delegate.h" | 5 #include "content/shell/browser/shell_download_manager_delegate.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 callback.Run(next_id++); | 105 callback.Run(next_id++); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void ShellDownloadManagerDelegate::GenerateFilename( | 108 void ShellDownloadManagerDelegate::GenerateFilename( |
| 109 uint32 download_id, | 109 uint32 download_id, |
| 110 const DownloadTargetCallback& callback, | 110 const DownloadTargetCallback& callback, |
| 111 const base::FilePath& generated_name, | 111 const base::FilePath& generated_name, |
| 112 const base::FilePath& suggested_directory) { | 112 const base::FilePath& suggested_directory) { |
| 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 114 if (!base::PathExists(suggested_directory)) | 114 if (!base::PathExists(suggested_directory)) |
| 115 file_util::CreateDirectory(suggested_directory); | 115 base::CreateDirectory(suggested_directory); |
| 116 | 116 |
| 117 base::FilePath suggested_path(suggested_directory.Append(generated_name)); | 117 base::FilePath suggested_path(suggested_directory.Append(generated_name)); |
| 118 BrowserThread::PostTask( | 118 BrowserThread::PostTask( |
| 119 BrowserThread::UI, | 119 BrowserThread::UI, |
| 120 FROM_HERE, | 120 FROM_HERE, |
| 121 base::Bind( | 121 base::Bind( |
| 122 &ShellDownloadManagerDelegate::OnDownloadPathGenerated, | 122 &ShellDownloadManagerDelegate::OnDownloadPathGenerated, |
| 123 this, download_id, callback, suggested_path)); | 123 this, download_id, callback, suggested_path)); |
| 124 } | 124 } |
| 125 | 125 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); | 202 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( | 205 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( |
| 206 const base::FilePath& default_download_path) { | 206 const base::FilePath& default_download_path) { |
| 207 default_download_path_ = default_download_path; | 207 default_download_path_ = default_download_path; |
| 208 suppress_prompting_ = true; | 208 suppress_prompting_ = true; |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace content | 211 } // namespace content |
| OLD | NEW |