| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/plugin_download_helper.h" | 5 #include "chrome/browser/plugin_download_helper.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) && !defined(USE_AURA) | 7 #if defined(OS_WIN) && !defined(USE_AURA) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 void PluginDownloadUrlHelper::OnURLFetchComplete( | 38 void PluginDownloadUrlHelper::OnURLFetchComplete( |
| 39 const content::URLFetcher* source) { | 39 const content::URLFetcher* source) { |
| 40 bool success = source->GetStatus().is_success(); | 40 bool success = source->GetStatus().is_success(); |
| 41 FilePath response_file; | 41 FilePath response_file; |
| 42 | 42 |
| 43 if (success) { | 43 if (success) { |
| 44 if (source->GetResponseAsFilePath(true, &response_file)) { | 44 if (source->GetResponseAsFilePath(true, &response_file)) { |
| 45 FilePath new_download_file_path = | 45 FilePath new_download_file_path = |
| 46 response_file.DirName().AppendASCII( | 46 response_file.DirName().AppendASCII( |
| 47 download_file_fetcher_->GetUrl().ExtractFileName()); | 47 download_file_fetcher_->GetURL().ExtractFileName()); |
| 48 | 48 |
| 49 file_util::Delete(new_download_file_path, false); | 49 file_util::Delete(new_download_file_path, false); |
| 50 | 50 |
| 51 if (!file_util::ReplaceFileW(response_file, | 51 if (!file_util::ReplaceFileW(response_file, |
| 52 new_download_file_path)) { | 52 new_download_file_path)) { |
| 53 DLOG(ERROR) << "Failed to rename file:" | 53 DLOG(ERROR) << "Failed to rename file:" |
| 54 << response_file.value() | 54 << response_file.value() |
| 55 << " to file:" | 55 << " to file:" |
| 56 << new_download_file_path.value(); | 56 << new_download_file_path.value(); |
| 57 } else { | 57 } else { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 if (::IsWindow(download_file_caller_window_)) { | 76 if (::IsWindow(download_file_caller_window_)) { |
| 77 ::SendMessage(download_file_caller_window_, WM_COPYDATA, NULL, | 77 ::SendMessage(download_file_caller_window_, WM_COPYDATA, NULL, |
| 78 reinterpret_cast<LPARAM>(&download_file_data)); | 78 reinterpret_cast<LPARAM>(&download_file_data)); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 // Don't access any members after this. | 81 // Don't access any members after this. |
| 82 delete this; | 82 delete this; |
| 83 } | 83 } |
| 84 | 84 |
| 85 #endif // defined(OS_WIN) && !defined(USE_AURA) | 85 #endif // defined(OS_WIN) && !defined(USE_AURA) |
| OLD | NEW |