summaryrefslogtreecommitdiffstats
path: root/content/worker/worker_webkitplatformsupport_impl.h
blob: f8965ad27e9d4a9427ce4076fa8dfa01fcc0a2a3 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Copyright (c) 2012 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 CONTENT_WORKER_WORKER_WEBKITPLATFORMSUPPORT_IMPL_H_
#define CONTENT_WORKER_WORKER_WEBKITPLATFORMSUPPORT_IMPL_H_

#include "base/memory/scoped_ptr.h"
#include "content/child/webkitplatformsupport_impl.h"
#include "third_party/WebKit/public/platform/WebIDBFactory.h"
#include "third_party/WebKit/public/platform/WebMimeRegistry.h"

namespace base {
class MessageLoopProxy;
}

namespace IPC {
class SyncMessageFilter;
}

namespace blink {
class WebFileUtilities;
}

namespace content {
class QuotaMessageFilter;
class ThreadSafeSender;
class WebFileSystemImpl;

class WorkerWebKitPlatformSupportImpl : public WebKitPlatformSupportImpl,
                                        public blink::WebMimeRegistry {
 public:
  WorkerWebKitPlatformSupportImpl(
      ThreadSafeSender* sender,
      IPC::SyncMessageFilter* sync_message_filter,
      QuotaMessageFilter* quota_message_filter);
  virtual ~WorkerWebKitPlatformSupportImpl();

  // WebKitPlatformSupport methods:
  virtual blink::WebClipboard* clipboard();
  virtual blink::WebMimeRegistry* mimeRegistry();
  virtual blink::WebFileSystem* fileSystem();
  virtual blink::WebFileUtilities* fileUtilities();
  virtual blink::WebSandboxSupport* sandboxSupport();
  virtual bool sandboxEnabled();
  virtual unsigned long long visitedLinkHash(const char* canonicalURL,
                                             size_t length);
  virtual bool isLinkVisited(unsigned long long linkHash);
  virtual blink::WebMessagePortChannel* createMessagePortChannel();
  virtual void setCookies(const blink::WebURL& url,
                          const blink::WebURL& first_party_for_cookies,
                          const blink::WebString& value);
  virtual blink::WebString cookies(
      const blink::WebURL& url,
      const blink::WebURL& first_party_for_cookies);
  virtual blink::WebString defaultLocale();
  virtual blink::WebStorageNamespace* createLocalStorageNamespace();
  virtual void dispatchStorageEvent(
      const blink::WebString& key, const blink::WebString& old_value,
      const blink::WebString& new_value, const blink::WebString& origin,
      const blink::WebURL& url, bool is_local_storage);

  virtual blink::Platform::FileHandle databaseOpenFile(
      const blink::WebString& vfs_file_name, int desired_flags);
  virtual int databaseDeleteFile(const blink::WebString& vfs_file_name,
                                 bool sync_dir);
  virtual long databaseGetFileAttributes(
      const blink::WebString& vfs_file_name);
  virtual long long databaseGetFileSize(
      const blink::WebString& vfs_file_name);
  virtual long long databaseGetSpaceAvailableForOrigin(
      const blink::WebString& origin_identifier);

  virtual blink::WebBlobRegistry* blobRegistry();

  virtual blink::WebIDBFactory* idbFactory();

  // WebMimeRegistry methods:
  virtual blink::WebMimeRegistry::SupportsType supportsMIMEType(
      const blink::WebString&);
  virtual blink::WebMimeRegistry::SupportsType supportsImageMIMEType(
      const blink::WebString&);
  virtual blink::WebMimeRegistry::SupportsType supportsJavaScriptMIMEType(
      const blink::WebString&);
  virtual blink::WebMimeRegistry::SupportsType supportsMediaMIMEType(
      const blink::WebString&,
      const blink::WebString&,
      const blink::WebString&);
  virtual bool supportsMediaSourceMIMEType(
      const blink::WebString&,
      const blink::WebString&);
  virtual blink::WebMimeRegistry::SupportsType supportsNonImageMIMEType(
      const blink::WebString&);
  virtual blink::WebString mimeTypeForExtension(const blink::WebString&);
  virtual blink::WebString wellKnownMimeTypeForExtension(
      const blink::WebString&);
  virtual blink::WebString mimeTypeFromFile(const blink::WebString&);
  virtual void queryStorageUsageAndQuota(
      const blink::WebURL& storage_partition,
      blink::WebStorageQuotaType,
      blink::WebStorageQuotaCallbacks*) OVERRIDE;

 private:

  class FileUtilities;
  scoped_ptr<FileUtilities> file_utilities_;
  scoped_ptr<blink::WebBlobRegistry> blob_registry_;
  scoped_ptr<blink::WebIDBFactory> web_idb_factory_;
  scoped_refptr<ThreadSafeSender> thread_safe_sender_;
  scoped_refptr<base::MessageLoopProxy> child_thread_loop_;
  scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
  scoped_refptr<QuotaMessageFilter> quota_message_filter_;
};

}  // namespace content

#endif  // CONTENT_WORKER_WORKER_WEBKITPLATFORMSUPPORT_IMPL_H_