Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame^] | 1 | // Copyright 2021 The Chromium Authors |
Alexey Baskakov | 9087edc | 2021-11-19 03:48:06 | [diff] [blame] | 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 CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_INTERNALS_UTILS_H_ |
| 6 | #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_INTERNALS_UTILS_H_ |
| 7 | |
| 8 | #include "base/callback_forward.h" |
| 9 | #include "base/strings/string_piece_forward.h" |
| 10 | #include "chrome/browser/web_applications/web_app_constants.h" |
| 11 | |
| 12 | namespace base { |
| 13 | class FilePath; |
| 14 | class Value; |
| 15 | } // namespace base |
| 16 | |
| 17 | namespace web_app { |
| 18 | |
| 19 | using ReadErrorLogCallback = |
| 20 | base::OnceCallback<void(Result, base::Value error_log)>; |
| 21 | |
| 22 | void ReadErrorLog(const base::FilePath& web_apps_directory, |
| 23 | base::StringPiece subsystem_name, |
| 24 | ReadErrorLogCallback callback); |
| 25 | |
| 26 | using FileIoCallback = base::OnceCallback<void(Result)>; |
| 27 | |
| 28 | void WriteErrorLog(const base::FilePath& web_apps_directory, |
| 29 | base::StringPiece subsystem_name, |
| 30 | base::Value error_log, |
| 31 | FileIoCallback callback); |
| 32 | |
| 33 | void ClearErrorLog(const base::FilePath& web_apps_directory, |
| 34 | base::StringPiece subsystem_name, |
| 35 | FileIoCallback callback); |
| 36 | |
| 37 | } // namespace web_app |
| 38 | |
| 39 | #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_INTERNALS_UTILS_H_ |