selected_file_info.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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
  3. // found in the LICENSE file.
  4. #include "ui/shell_dialogs/selected_file_info.h"
  5. namespace ui {
  6. SelectedFileInfo::SelectedFileInfo() {}
  7. SelectedFileInfo::SelectedFileInfo(const base::FilePath& in_file_path,
  8. const base::FilePath& in_local_path)
  9. : file_path(in_file_path),
  10. local_path(in_local_path) {
  11. display_name = in_file_path.BaseName().value();
  12. }
  13. SelectedFileInfo::SelectedFileInfo(const SelectedFileInfo& other) = default;
  14. SelectedFileInfo::SelectedFileInfo(SelectedFileInfo&& other) = default;
  15. SelectedFileInfo::~SelectedFileInfo() {}
  16. SelectedFileInfo& SelectedFileInfo::operator=(const SelectedFileInfo& other) =
  17. default;
  18. SelectedFileInfo& SelectedFileInfo::operator=(SelectedFileInfo&& other) =
  19. default;
  20. // Converts a list of FilePaths to a list of ui::SelectedFileInfo.
  21. std::vector<SelectedFileInfo> FilePathListToSelectedFileInfoList(
  22. const std::vector<base::FilePath>& paths) {
  23. std::vector<SelectedFileInfo> selected_files;
  24. for (const auto& path : paths)
  25. selected_files.push_back(SelectedFileInfo(path, path));
  26. return selected_files;
  27. }
  28. } // namespace ui