1 // Copyright (c) 2012 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 CONTENT_WORKER_WORKER_WEBKITPLATFORMSUPPORT_IMPL_H_
6 #define CONTENT_WORKER_WORKER_WEBKITPLATFORMSUPPORT_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/child/webkitplatformsupport_impl.h"
10 #include "third_party/WebKit/public/platform/WebIDBFactory.h"
11 #include "third_party/WebKit/public/platform/WebMimeRegistry.h"
14 class MessageLoopProxy
;
18 class SyncMessageFilter
;
22 class WebFileUtilities
;
26 class ThreadSafeSender
;
27 class WebFileSystemImpl
;
29 class WorkerWebKitPlatformSupportImpl
: public WebKitPlatformSupportImpl
,
30 public WebKit::WebMimeRegistry
{
32 WorkerWebKitPlatformSupportImpl(
33 ThreadSafeSender
* sender
,
34 IPC::SyncMessageFilter
* sync_message_filter
);
35 virtual ~WorkerWebKitPlatformSupportImpl();
37 // WebKitPlatformSupport methods:
38 virtual WebKit::WebClipboard
* clipboard();
39 virtual WebKit::WebMimeRegistry
* mimeRegistry();
40 virtual WebKit::WebFileSystem
* fileSystem();
41 virtual WebKit::WebFileUtilities
* fileUtilities();
42 virtual WebKit::WebSandboxSupport
* sandboxSupport();
43 virtual bool sandboxEnabled();
44 virtual unsigned long long visitedLinkHash(const char* canonicalURL
,
46 virtual bool isLinkVisited(unsigned long long linkHash
);
47 virtual WebKit::WebMessagePortChannel
* createMessagePortChannel();
48 virtual void setCookies(const WebKit::WebURL
& url
,
49 const WebKit::WebURL
& first_party_for_cookies
,
50 const WebKit::WebString
& value
);
51 virtual WebKit::WebString
cookies(
52 const WebKit::WebURL
& url
,
53 const WebKit::WebURL
& first_party_for_cookies
);
54 virtual void prefetchHostName(const WebKit::WebString
&);
55 virtual WebKit::WebString
defaultLocale();
56 virtual WebKit::WebStorageNamespace
* createLocalStorageNamespace(
57 const WebKit::WebString
& path
, unsigned quota
);
58 virtual void dispatchStorageEvent(
59 const WebKit::WebString
& key
, const WebKit::WebString
& old_value
,
60 const WebKit::WebString
& new_value
, const WebKit::WebString
& origin
,
61 const WebKit::WebURL
& url
, bool is_local_storage
);
63 virtual WebKit::Platform::FileHandle
databaseOpenFile(
64 const WebKit::WebString
& vfs_file_name
, int desired_flags
);
65 virtual int databaseDeleteFile(const WebKit::WebString
& vfs_file_name
,
67 virtual long databaseGetFileAttributes(
68 const WebKit::WebString
& vfs_file_name
);
69 virtual long long databaseGetFileSize(
70 const WebKit::WebString
& vfs_file_name
);
71 virtual long long databaseGetSpaceAvailableForOrigin(
72 const WebKit::WebString
& origin_identifier
);
74 virtual WebKit::WebBlobRegistry
* blobRegistry();
76 virtual WebKit::WebIDBFactory
* idbFactory();
78 // WebMimeRegistry methods:
79 virtual WebKit::WebMimeRegistry::SupportsType
supportsMIMEType(
80 const WebKit::WebString
&);
81 virtual WebKit::WebMimeRegistry::SupportsType
supportsImageMIMEType(
82 const WebKit::WebString
&);
83 virtual WebKit::WebMimeRegistry::SupportsType
supportsJavaScriptMIMEType(
84 const WebKit::WebString
&);
85 // TODO(ddorwin): Remove after http://webk.it/82983 lands.
86 virtual WebKit::WebMimeRegistry::SupportsType
supportsMediaMIMEType(
87 const WebKit::WebString
&, const WebKit::WebString
&);
88 virtual WebKit::WebMimeRegistry::SupportsType
supportsMediaMIMEType(
89 const WebKit::WebString
&,
90 const WebKit::WebString
&,
91 const WebKit::WebString
&);
92 virtual bool supportsMediaSourceMIMEType(
93 const WebKit::WebString
&,
94 const WebKit::WebString
&);
95 virtual WebKit::WebMimeRegistry::SupportsType
supportsNonImageMIMEType(
96 const WebKit::WebString
&);
97 virtual WebKit::WebString
mimeTypeForExtension(const WebKit::WebString
&);
98 virtual WebKit::WebString
wellKnownMimeTypeForExtension(
99 const WebKit::WebString
&);
100 virtual WebKit::WebString
mimeTypeFromFile(const WebKit::WebString
&);
101 virtual WebKit::WebString
preferredExtensionForMIMEType(
102 const WebKit::WebString
&);
107 scoped_ptr
<FileUtilities
> file_utilities_
;
108 scoped_ptr
<WebKit::WebBlobRegistry
> blob_registry_
;
109 scoped_ptr
<WebFileSystemImpl
> web_file_system_
;
110 scoped_ptr
<WebKit::WebIDBFactory
> web_idb_factory_
;
111 scoped_refptr
<ThreadSafeSender
> thread_safe_sender_
;
112 scoped_refptr
<base::MessageLoopProxy
> child_thread_loop_
;
113 scoped_refptr
<IPC::SyncMessageFilter
> sync_message_filter_
;
116 } // namespace content
118 #endif // CONTENT_WORKER_WORKER_WEBKITPLATFORMSUPPORT_IMPL_H_