| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 base::FilePath result; | 170 base::FilePath result; |
| 171 #if defined(OS_WIN) | 171 #if defined(OS_WIN) |
| 172 std::wstring file_part = base::FilePath(suggested_path).BaseName().value(); | 172 std::wstring file_part = base::FilePath(suggested_path).BaseName().value(); |
| 173 wchar_t file_name[MAX_PATH]; | 173 wchar_t file_name[MAX_PATH]; |
| 174 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); | 174 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); |
| 175 OPENFILENAME save_as; | 175 OPENFILENAME save_as; |
| 176 ZeroMemory(&save_as, sizeof(save_as)); | 176 ZeroMemory(&save_as, sizeof(save_as)); |
| 177 save_as.lStructSize = sizeof(OPENFILENAME); | 177 save_as.lStructSize = sizeof(OPENFILENAME); |
| 178 save_as.hwndOwner = item->GetWebContents()->GetView()->GetNativeView()-> | 178 save_as.hwndOwner = item->GetWebContents()->GetView()->GetNativeView()-> |
| 179 GetDispatcher()->host()->GetAcceleratedWidget(); | 179 GetHost()->GetAcceleratedWidget(); |
| 180 save_as.lpstrFile = file_name; | 180 save_as.lpstrFile = file_name; |
| 181 save_as.nMaxFile = arraysize(file_name); | 181 save_as.nMaxFile = arraysize(file_name); |
| 182 | 182 |
| 183 std::wstring directory; | 183 std::wstring directory; |
| 184 if (!suggested_path.empty()) | 184 if (!suggested_path.empty()) |
| 185 directory = suggested_path.DirName().value(); | 185 directory = suggested_path.DirName().value(); |
| 186 | 186 |
| 187 save_as.lpstrInitialDir = directory.c_str(); | 187 save_as.lpstrInitialDir = directory.c_str(); |
| 188 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | | 188 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | |
| 189 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; | 189 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); | 222 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( | 225 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( |
| 226 const base::FilePath& default_download_path) { | 226 const base::FilePath& default_download_path) { |
| 227 default_download_path_ = default_download_path; | 227 default_download_path_ = default_download_path; |
| 228 suppress_prompting_ = true; | 228 suppress_prompting_ = true; |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace content | 231 } // namespace content |
| OLD | NEW |