1 // Copyright (c) 2014 Intel Corporation. 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 XWALK_EXPERIMENTAL_NATIVE_FILE_SYSTEM_NATIVE_FILE_SYSTEM_EXTENSION_H_
6 #define XWALK_EXPERIMENTAL_NATIVE_FILE_SYSTEM_NATIVE_FILE_SYSTEM_EXTENSION_H_
10 #include "base/values.h"
11 #include "content/public/browser/render_process_host.h"
12 #include "xwalk/extensions/browser/xwalk_extension_function_handler.h"
13 #include "xwalk/extensions/common/xwalk_extension.h"
16 namespace experimental {
18 using extensions::XWalkExtension;
19 using extensions::XWalkExtensionFunctionHandler;
20 using extensions::XWalkExtensionFunctionInfo;
21 using extensions::XWalkExtensionInstance;
23 class NativeFileSystemExtension : public XWalkExtension {
25 explicit NativeFileSystemExtension(content::RenderProcessHost* host);
26 virtual ~NativeFileSystemExtension();
28 // XWalkExtension implementation.
29 virtual XWalkExtensionInstance* CreateInstance() OVERRIDE;
32 content::RenderProcessHost* host_;
35 class NativeFileSystemInstance : public XWalkExtensionInstance {
37 explicit NativeFileSystemInstance(content::RenderProcessHost* host);
39 // XWalkExtensionInstance implementation.
40 virtual void HandleMessage(scoped_ptr<base::Value> msg) OVERRIDE;
43 XWalkExtensionFunctionHandler handler_;
44 content::RenderProcessHost* host_;
47 class FileSystemChecker
48 : public base::RefCountedThreadSafe<FileSystemChecker> {
52 const std::string& path,
53 const std::string& root_name,
54 const std::string& promise_id,
55 XWalkExtensionInstance* instance);
59 void RegisterFileSystemsAndSendResponse();
63 std::string root_name_;
64 std::string promise_id_;
65 XWalkExtensionInstance* instance_;
67 DISALLOW_COPY_AND_ASSIGN(FileSystemChecker);
70 } // namespace experimental
73 #endif // XWALK_EXPERIMENTAL_NATIVE_FILE_SYSTEM_NATIVE_FILE_SYSTEM_EXTENSION_H_