• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.  Use of this
2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file.
4 
5 #ifndef WEBFILEUTILITIES_IMPL_H_
6 #define WEBFILEUTILITIES_IMPL_H_
7 
8 #include "base/platform_file.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileUtilities.h"
10 
11 namespace webkit_glue {
12 
13 class WebFileUtilitiesImpl : public WebKit::WebFileUtilities {
14  public:
15   WebFileUtilitiesImpl();
16   virtual ~WebFileUtilitiesImpl();
17 
18   // WebFileUtilities methods:
19   virtual void revealFolderInOS(const WebKit::WebString& path);
20   virtual bool fileExists(const WebKit::WebString& path);
21   virtual bool deleteFile(const WebKit::WebString& path);
22   virtual bool deleteEmptyDirectory(const WebKit::WebString& path);
23   virtual bool getFileSize(const WebKit::WebString& path, long long& result);
24   virtual bool getFileModificationTime(
25       const WebKit::WebString& path,
26       double& result);
27   virtual WebKit::WebString directoryName(const WebKit::WebString& path);
28   virtual WebKit::WebString pathByAppendingComponent(
29       const WebKit::WebString& path, const WebKit::WebString& component);
30   virtual bool makeAllDirectories(const WebKit::WebString& path);
31   virtual WebKit::WebString getAbsolutePath(const WebKit::WebString& path);
32   virtual bool isDirectory(const WebKit::WebString& path);
33   virtual WebKit::WebURL filePathToURL(const WebKit::WebString& path);
34   virtual base::PlatformFile openFile(const WebKit::WebString& path, int mode);
35   virtual void closeFile(base::PlatformFile& handle);
36   virtual long long seekFile(base::PlatformFile handle,
37                              long long offset,
38                              int origin);
39   virtual bool truncateFile(base::PlatformFile handle, long long offset);
40   virtual int readFromFile(base::PlatformFile handle, char* data, int length);
41   virtual int writeToFile(base::PlatformFile handle,
42                           const char* data,
43                           int length);
44 
set_sandbox_enabled(bool sandbox_enabled)45   void set_sandbox_enabled(bool sandbox_enabled) {
46     sandbox_enabled_ = sandbox_enabled;
47   }
48 
49  protected:
50   bool sandbox_enabled_;
51 };
52 
53 }  // namespace webkit_glue
54 
55 #endif  // WEBFILEUTILITIES_IMPL_H_
56