file_path_mojom_traits.cc 629 B

123456789101112131415161718192021222324252627
  1. // Copyright 2020 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 "ash/components/smbfs/file_path_mojom_traits.h"
  5. namespace mojo {
  6. // static
  7. bool StructTraits<smbfs::mojom::FilePathDataView, base::FilePath>::Read(
  8. smbfs::mojom::FilePathDataView data,
  9. base::FilePath* out) {
  10. std::string path;
  11. if (!data.ReadPath(&path)) {
  12. return false;
  13. }
  14. base::FilePath file_path(path);
  15. if (path.compare(file_path.value()) != 0) {
  16. return false;
  17. }
  18. *out = file_path;
  19. return true;
  20. }
  21. } // namespace mojo