Update V8 to version 4.7.21.
[chromium-blink-merge.git] / components / filesystem / file_system_impl.h
blob2cda44d555830d9eea431f168e455d3247c8039e
1 // Copyright 2015 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.
5 #ifndef COMPONENTS_FILESYSTEM_FILE_SYSTEM_IMPL_H_
6 #define COMPONENTS_FILESYSTEM_FILE_SYSTEM_IMPL_H_
8 #include "base/macros.h"
9 #include "components/filesystem/public/interfaces/file_system.mojom.h"
10 #include "mojo/public/cpp/bindings/interface_request.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h"
13 namespace base {
14 class FilePath;
17 namespace mojo {
18 class ApplicationConnection;
21 namespace filesystem {
22 class FileSystemApp;
24 class FileSystemImpl : public FileSystem {
25 public:
26 FileSystemImpl(FileSystemApp* app,
27 mojo::ApplicationConnection* connection,
28 mojo::InterfaceRequest<FileSystem> request);
29 ~FileSystemImpl() override;
31 // |Files| implementation:
33 // Current valid values for |file_system| are "temp" for a temporary
34 // filesystem and "origin" for a persistent filesystem bound to the origin of
35 // the URL of the caller.
36 void OpenFileSystem(const mojo::String& file_system,
37 mojo::InterfaceRequest<Directory> directory,
38 FileSystemClientPtr client,
39 const OpenFileSystemCallback& callback) override;
41 private:
42 // Gets the system specific toplevel profile directory.
43 base::FilePath GetSystemProfileDir() const;
45 // Takes the origin string from |remote_application_url_|.
46 std::string GetOriginFromRemoteApplicationURL() const;
48 // Sanitizes |origin| so it is an acceptable filesystem name.
49 void BuildSanitizedOrigin(const std::string& origin,
50 std::string* sanitized_origin);
52 FileSystemApp* app_;
53 const std::string remote_application_url_;
54 mojo::StrongBinding<FileSystem> binding_;
56 DISALLOW_COPY_AND_ASSIGN(FileSystemImpl);
59 } // namespace filesystem
61 #endif // COMPONENTS_FILESYSTEM_FILE_SYSTEM_IMPL_H_