Chromium Code Reviews| Index: services/flog/flog_directory.h |
| diff --git a/services/flog/flog_directory.h b/services/flog/flog_directory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cb2b59b042a472f5c6a2053c2b486107f29e3ede |
| --- /dev/null |
| +++ b/services/flog/flog_directory.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2016 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. |
| + |
| +#ifndef MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_ |
| +#define MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_ |
| + |
| +#include <map> |
| + |
| +#include "mojo/public/cpp/application/connect.h" |
| +#include "mojo/services/files/interfaces/directory.mojom.h" |
| +#include "mojo/services/files/interfaces/file.mojom.h" |
| +#include "mojo/services/files/interfaces/files.mojom.h" |
| + |
| +namespace mojo { |
| +namespace flog { |
| + |
| +// Flog directory management. |
| +class FlogDirectory { |
| + public: |
| + using GetExistingFilesCallback = |
| + std::function<void(std::map<uint32_t, std::string>&&)>; |
|
kulakowski
2016/06/13 20:14:26
Style guide still bans rvalue refs outside the mov
|
| + |
| + FlogDirectory(Shell* shell); |
| + |
| + ~FlogDirectory(); |
| + |
| + // Calls back with a map (id -> label) of existing files. |
| + void GetExistingFiles(GetExistingFilesCallback callback); |
| + |
| + // Gets a FilePtr for the indicated file. |
| + files::FilePtr GetFile(uint32_t id, const std::string& label, bool create); |
| + |
| + private: |
| + static const size_t kLogIdWidth = 8; |
| + |
| + // Returns a log file name given the id and label of the log. |
| + std::string LogFileName(uint32_t id, const std::string& label); |
| + |
| + // Parses a log file name. |
| + bool ParseLogFileName(const std::string& name, |
| + uint32_t* id_out, |
| + std::string* label_out); |
| + |
| + files::FilesPtr files_; |
| + files::DirectoryPtr file_system_; |
| +}; |
| + |
| +} // namespace flog |
| +} // namespace mojo |
| + |
| +#endif // MOJO_SERVICES_FLOG_FLOG_DIRECTORY_H_ |