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

Side by Side Diff: chrome/browser/file_select_helper.cc

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
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 "chrome/browser/file_select_helper.h" 5 #include "chrome/browser/file_select_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 StartNewEnumeration(path, kFileSelectEnumerationId, 194 StartNewEnumeration(path, kFileSelectEnumerationId,
195 render_frame_host_->GetRenderViewHost()); 195 render_frame_host_->GetRenderViewHost());
196 return; 196 return;
197 } 197 }
198 198
199 std::vector<ui::SelectedFileInfo> files; 199 std::vector<ui::SelectedFileInfo> files;
200 files.push_back(file); 200 files.push_back(file);
201 201
202 #if defined(OS_MACOSX) 202 #if defined(OS_MACOSX)
203 base::PostTaskWithTraits( 203 base::PostTaskWithTraits(
204 FROM_HERE, base::TaskTraits().MayBlock().WithShutdownBehavior( 204 FROM_HERE,
205 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), 205 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
206 base::Bind(&FileSelectHelper::ProcessSelectedFilesMac, this, files)); 206 base::Bind(&FileSelectHelper::ProcessSelectedFilesMac, this, files));
207 #else 207 #else
208 NotifyRenderFrameHostAndEnd(files); 208 NotifyRenderFrameHostAndEnd(files);
209 #endif // defined(OS_MACOSX) 209 #endif // defined(OS_MACOSX)
210 } 210 }
211 211
212 void FileSelectHelper::MultiFilesSelected( 212 void FileSelectHelper::MultiFilesSelected(
213 const std::vector<base::FilePath>& files, 213 const std::vector<base::FilePath>& files,
214 void* params) { 214 void* params) {
215 std::vector<ui::SelectedFileInfo> selected_files = 215 std::vector<ui::SelectedFileInfo> selected_files =
216 FilePathListToSelectedFileInfoList(files); 216 FilePathListToSelectedFileInfoList(files);
217 217
218 MultiFilesSelectedWithExtraInfo(selected_files, params); 218 MultiFilesSelectedWithExtraInfo(selected_files, params);
219 } 219 }
220 220
221 void FileSelectHelper::MultiFilesSelectedWithExtraInfo( 221 void FileSelectHelper::MultiFilesSelectedWithExtraInfo(
222 const std::vector<ui::SelectedFileInfo>& files, 222 const std::vector<ui::SelectedFileInfo>& files,
223 void* params) { 223 void* params) {
224 if (!files.empty() && IsValidProfile(profile_)) { 224 if (!files.empty() && IsValidProfile(profile_)) {
225 base::FilePath path = files[0].file_path; 225 base::FilePath path = files[0].file_path;
226 if (dialog_mode_ != FileChooserParams::UploadFolder) 226 if (dialog_mode_ != FileChooserParams::UploadFolder)
227 path = path.DirName(); 227 path = path.DirName();
228 profile_->set_last_selected_directory(path); 228 profile_->set_last_selected_directory(path);
229 } 229 }
230 #if defined(OS_MACOSX) 230 #if defined(OS_MACOSX)
231 base::PostTaskWithTraits( 231 base::PostTaskWithTraits(
232 FROM_HERE, base::TaskTraits().MayBlock().WithShutdownBehavior( 232 FROM_HERE,
233 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), 233 {base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
234 base::Bind(&FileSelectHelper::ProcessSelectedFilesMac, this, files)); 234 base::Bind(&FileSelectHelper::ProcessSelectedFilesMac, this, files));
235 #else 235 #else
236 NotifyRenderFrameHostAndEnd(files); 236 NotifyRenderFrameHostAndEnd(files);
237 #endif // defined(OS_MACOSX) 237 #endif // defined(OS_MACOSX)
238 } 238 }
239 239
240 void FileSelectHelper::FileSelectionCanceled(void* params) { 240 void FileSelectHelper::FileSelectionCanceled(void* params) {
241 NotifyRenderFrameHostAndEnd(std::vector<ui::SelectedFileInfo>()); 241 NotifyRenderFrameHostAndEnd(std::vector<ui::SelectedFileInfo>());
242 } 242 }
243 243
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 692
693 // static 693 // static
694 base::FilePath FileSelectHelper::GetSanitizedFileName( 694 base::FilePath FileSelectHelper::GetSanitizedFileName(
695 const base::FilePath& suggested_filename) { 695 const base::FilePath& suggested_filename) {
696 if (suggested_filename.empty()) 696 if (suggested_filename.empty())
697 return base::FilePath(); 697 return base::FilePath();
698 return net::GenerateFileName( 698 return net::GenerateFileName(
699 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), 699 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(),
700 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); 700 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME));
701 } 701 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698