summaryrefslogtreecommitdiff
path: root/chromium/mojo/public/cpp/base/file_info_mojom_traits.cc
blob: 64a08029573da59bb6e9c74b44871f177e237ec7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "mojo/public/cpp/base/file_info_mojom_traits.h"

#include "base/logging.h"
#include "mojo/public/cpp/base/time_mojom_traits.h"

namespace mojo {

// static
bool StructTraits<mojo_base::mojom::FileInfoDataView, base::File::Info>::Read(
    mojo_base::mojom::FileInfoDataView data,
    base::File::Info* out) {
  if (!data.ReadLastModified(&out->last_modified))
    return false;
  if (!data.ReadLastAccessed(&out->last_accessed))
    return false;
  if (!data.ReadCreationTime(&out->creation_time))
    return false;
  out->size = data.size();
  out->is_directory = data.is_directory();
  out->is_symbolic_link = data.is_symbolic_link();
  return true;
}

}  // namespace mojo