| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell_download_manager_delegate.h" | 5 #include "content/shell/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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 base::FilePath result; | 130 base::FilePath result; |
| 131 #if defined(OS_WIN) && !defined(USE_AURA) | 131 #if defined(OS_WIN) && !defined(USE_AURA) |
| 132 std::wstring file_part = base::FilePath(suggested_path).BaseName().value(); | 132 std::wstring file_part = base::FilePath(suggested_path).BaseName().value(); |
| 133 wchar_t file_name[MAX_PATH]; | 133 wchar_t file_name[MAX_PATH]; |
| 134 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); | 134 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); |
| 135 OPENFILENAME save_as; | 135 OPENFILENAME save_as; |
| 136 ZeroMemory(&save_as, sizeof(save_as)); | 136 ZeroMemory(&save_as, sizeof(save_as)); |
| 137 save_as.lStructSize = sizeof(OPENFILENAME); | 137 save_as.lStructSize = sizeof(OPENFILENAME); |
| 138 save_as.hwndOwner = item->GetWebContents()->GetNativeView(); | 138 save_as.hwndOwner = item->GetWebContents()->GetView()->GetNativeView(); |
| 139 save_as.lpstrFile = file_name; | 139 save_as.lpstrFile = file_name; |
| 140 save_as.nMaxFile = arraysize(file_name); | 140 save_as.nMaxFile = arraysize(file_name); |
| 141 | 141 |
| 142 std::wstring directory; | 142 std::wstring directory; |
| 143 if (!suggested_path.empty()) | 143 if (!suggested_path.empty()) |
| 144 directory = suggested_path.DirName().value(); | 144 directory = suggested_path.DirName().value(); |
| 145 | 145 |
| 146 save_as.lpstrInitialDir = directory.c_str(); | 146 save_as.lpstrInitialDir = directory.c_str(); |
| 147 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | | 147 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | |
| 148 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; | 148 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); | 180 DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, result); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( | 183 void ShellDownloadManagerDelegate::SetDownloadBehaviorForTesting( |
| 184 const base::FilePath& default_download_path) { | 184 const base::FilePath& default_download_path) { |
| 185 default_download_path_ = default_download_path; | 185 default_download_path_ = default_download_path; |
| 186 suppress_prompting_ = true; | 186 suppress_prompting_ = true; |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace content | 189 } // namespace content |
| OLD | NEW |