1 // Copyright 2019 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 
5 #ifndef CONTENT_BROWSER_NATIVE_FILE_SYSTEM_NATIVE_FILE_SYSTEM_ERROR_H_
6 #define CONTENT_BROWSER_NATIVE_FILE_SYSTEM_NATIVE_FILE_SYSTEM_ERROR_H_
7 
8 #include <string>
9 
10 #include "base/files/file.h"
11 #include "base/strings/string_piece.h"
12 #include "third_party/blink/public/mojom/native_file_system/native_file_system_error.mojom.h"
13 
14 namespace content {
15 namespace native_file_system_error {
16 
17 // Returns a NativeFileSystemError representing a successful result of an
18 // operation.
19 blink::mojom::NativeFileSystemErrorPtr Ok();
20 
21 // Wraps a base::File::Error in a NativeFileSystemError, optionally with a
22 // custom error message.
23 blink::mojom::NativeFileSystemErrorPtr FromFileError(
24     base::File::Error result,
25     base::StringPiece message = "");
26 
27 // Wraps a NativeFileSystemStatus in a NativeFileSystemError, optionally with a
28 // custom error message.
29 blink::mojom::NativeFileSystemErrorPtr FromStatus(
30     blink::mojom::NativeFileSystemStatus status,
31     base::StringPiece message = "");
32 
33 }  // namespace native_file_system_error
34 }  // namespace content
35 
36 #endif  // CONTENT_BROWSER_NATIVE_FILE_SYSTEM_NATIVE_FILE_SYSTEM_ERROR_H_
37