summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webfileutilities_impl.h
blob: 14d7a4222ac908d6052ffb5af3b930f7809a6afc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2010 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 WEBFILEUTILITIES_IMPL_H_
#define WEBFILEUTILITIES_IMPL_H_

#include "base/platform_file.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileUtilities.h"

namespace webkit_glue {

class WebFileUtilitiesImpl : public WebKit::WebFileUtilities {
 public:
  WebFileUtilitiesImpl();
  virtual ~WebFileUtilitiesImpl();

  // WebFileUtilities methods:
  virtual void revealFolderInOS(const WebKit::WebString& path);
  virtual bool fileExists(const WebKit::WebString& path);
  virtual bool deleteFile(const WebKit::WebString& path);
  virtual bool deleteEmptyDirectory(const WebKit::WebString& path);
  virtual bool getFileSize(const WebKit::WebString& path, long long& result);
  virtual bool getFileModificationTime(
      const WebKit::WebString& path,
      double& result);
  virtual WebKit::WebString directoryName(const WebKit::WebString& path);
  virtual WebKit::WebString pathByAppendingComponent(
      const WebKit::WebString& path, const WebKit::WebString& component);
  virtual bool makeAllDirectories(const WebKit::WebString& path);
  virtual WebKit::WebString getAbsolutePath(const WebKit::WebString& path);
  virtual bool isDirectory(const WebKit::WebString& path);
  virtual WebKit::WebURL filePathToURL(const WebKit::WebString& path);
  virtual base::PlatformFile openFile(const WebKit::WebString& path, int mode);
  virtual void closeFile(base::PlatformFile& handle);
  virtual long long seekFile(base::PlatformFile handle,
                             long long offset,
                             int origin);
  virtual bool truncateFile(base::PlatformFile handle, long long offset);
  virtual int readFromFile(base::PlatformFile handle, char* data, int length);
  virtual int writeToFile(base::PlatformFile handle,
                          const char* data,
                          int length);

  void set_sandbox_enabled(bool sandbox_enabled) {
    sandbox_enabled_ = sandbox_enabled;
  }

 protected:
  bool sandbox_enabled_;
};

}  // namespace webkit_glue

#endif  // WEBFILEUTILITIES_IMPL_H_