Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: content/shell/shell_download_manager_delegate.cc

Issue 9589003: Replace void* with int32 for passing download_id to SelectFileDialog::Listener. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix browser/unit tests Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/shell/shell_download_manager_delegate.h ('k') | content/test/mock_download_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/shell/shell_download_manager_delegate.h" 5 #include "content/shell/shell_download_manager_delegate.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <commdlg.h> 9 #include <commdlg.h>
10 #endif 10 #endif
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 download_manager_->GetActiveDownloadItem(download_id); 97 download_manager_->GetActiveDownloadItem(download_id);
98 if (!download) 98 if (!download)
99 return; 99 return;
100 download->SetFileCheckResults(state); 100 download->SetFileCheckResults(state);
101 download_manager_->RestartDownload(download_id); 101 download_manager_->RestartDownload(download_id);
102 } 102 }
103 103
104 void ShellDownloadManagerDelegate::ChooseDownloadPath( 104 void ShellDownloadManagerDelegate::ChooseDownloadPath(
105 WebContents* web_contents, 105 WebContents* web_contents,
106 const FilePath& suggested_path, 106 const FilePath& suggested_path,
107 void* data) { 107 int32 download_id) {
108 FilePath result; 108 FilePath result;
109 #if defined(OS_WIN) 109 #if defined(OS_WIN)
110 std::wstring file_part = FilePath(suggested_path).BaseName().value(); 110 std::wstring file_part = FilePath(suggested_path).BaseName().value();
111 wchar_t file_name[MAX_PATH]; 111 wchar_t file_name[MAX_PATH];
112 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name)); 112 base::wcslcpy(file_name, file_part.c_str(), arraysize(file_name));
113 OPENFILENAME save_as; 113 OPENFILENAME save_as;
114 ZeroMemory(&save_as, sizeof(save_as)); 114 ZeroMemory(&save_as, sizeof(save_as));
115 save_as.lStructSize = sizeof(OPENFILENAME); 115 save_as.lStructSize = sizeof(OPENFILENAME);
116 save_as.hwndOwner = web_contents->GetNativeView(); 116 save_as.hwndOwner = web_contents->GetNativeView();
117 save_as.lpstrFile = file_name; 117 save_as.lpstrFile = file_name;
118 save_as.nMaxFile = arraysize(file_name); 118 save_as.nMaxFile = arraysize(file_name);
119 119
120 std::wstring directory; 120 std::wstring directory;
121 if (!suggested_path.empty()) 121 if (!suggested_path.empty())
122 directory = suggested_path.DirName().value(); 122 directory = suggested_path.DirName().value();
123 123
124 save_as.lpstrInitialDir = directory.c_str(); 124 save_as.lpstrInitialDir = directory.c_str();
125 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING | 125 save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING |
126 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST; 126 OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST;
127 127
128 if (GetSaveFileName(&save_as)) 128 if (GetSaveFileName(&save_as))
129 result = FilePath(std::wstring(save_as.lpstrFile)); 129 result = FilePath(std::wstring(save_as.lpstrFile));
130 #else 130 #else
131 NOTIMPLEMENTED(); 131 NOTIMPLEMENTED();
132 #endif 132 #endif
133 133
134 if (result.empty()) { 134 if (result.empty()) {
135 download_manager_->FileSelectionCanceled(data); 135 download_manager_->FileSelectionCanceled(download_id);
136 } else { 136 } else {
137 download_manager_->FileSelected(result, data); 137 download_manager_->FileSelected(result, download_id);
138 } 138 }
139 } 139 }
140 140
141 } // namespace content 141 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_download_manager_delegate.h ('k') | content/test/mock_download_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698