IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / worker / worker_webkitplatformsupport_impl.h
blob784dcca8e5a243801fdde087e13613d15fac6b49
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"
13 namespace base {
14 class MessageLoopProxy;
17 namespace IPC {
18 class SyncMessageFilter;
21 namespace blink {
22 class WebFileUtilities;
25 namespace content {
26 class QuotaMessageFilter;
27 class ThreadSafeSender;
28 class WebDatabaseObserverImpl;
29 class WebFileSystemImpl;
31 class WorkerWebKitPlatformSupportImpl : public WebKitPlatformSupportImpl,
32 public blink::WebMimeRegistry {
33 public:
34 WorkerWebKitPlatformSupportImpl(
35 ThreadSafeSender* sender,
36 IPC::SyncMessageFilter* sync_message_filter,
37 QuotaMessageFilter* quota_message_filter);
38 virtual ~WorkerWebKitPlatformSupportImpl();
40 // WebKitPlatformSupport methods:
41 virtual blink::WebClipboard* clipboard();
42 virtual blink::WebMimeRegistry* mimeRegistry();
43 virtual blink::WebFileSystem* fileSystem();
44 virtual blink::WebFileUtilities* fileUtilities();
45 virtual blink::WebSandboxSupport* sandboxSupport();
46 virtual bool sandboxEnabled();
47 virtual unsigned long long visitedLinkHash(const char* canonicalURL,
48 size_t length);
49 virtual bool isLinkVisited(unsigned long long linkHash);
50 virtual blink::WebMessagePortChannel* createMessagePortChannel();
51 virtual void setCookies(const blink::WebURL& url,
52 const blink::WebURL& first_party_for_cookies,
53 const blink::WebString& value);
54 virtual blink::WebString cookies(
55 const blink::WebURL& url,
56 const blink::WebURL& first_party_for_cookies);
57 virtual blink::WebString defaultLocale();
58 virtual blink::WebStorageNamespace* createLocalStorageNamespace();
59 virtual void dispatchStorageEvent(
60 const blink::WebString& key, const blink::WebString& old_value,
61 const blink::WebString& new_value, const blink::WebString& origin,
62 const blink::WebURL& url, bool is_local_storage);
64 virtual blink::Platform::FileHandle databaseOpenFile(
65 const blink::WebString& vfs_file_name, int desired_flags);
66 virtual int databaseDeleteFile(const blink::WebString& vfs_file_name,
67 bool sync_dir);
68 virtual long databaseGetFileAttributes(
69 const blink::WebString& vfs_file_name);
70 virtual long long databaseGetFileSize(
71 const blink::WebString& vfs_file_name);
72 virtual long long databaseGetSpaceAvailableForOrigin(
73 const blink::WebString& origin_identifier);
74 virtual blink::WebBlobRegistry* blobRegistry();
75 virtual blink::WebIDBFactory* idbFactory();
76 virtual blink::WebDatabaseObserver* databaseObserver();
78 // WebMimeRegistry methods:
79 virtual blink::WebMimeRegistry::SupportsType supportsMIMEType(
80 const blink::WebString&);
81 virtual blink::WebMimeRegistry::SupportsType supportsImageMIMEType(
82 const blink::WebString&);
83 virtual blink::WebMimeRegistry::SupportsType supportsJavaScriptMIMEType(
84 const blink::WebString&);
85 virtual blink::WebMimeRegistry::SupportsType supportsMediaMIMEType(
86 const blink::WebString&,
87 const blink::WebString&,
88 const blink::WebString&);
89 virtual bool supportsMediaSourceMIMEType(
90 const blink::WebString&,
91 const blink::WebString&);
92 virtual blink::WebMimeRegistry::SupportsType supportsNonImageMIMEType(
93 const blink::WebString&);
94 virtual blink::WebString mimeTypeForExtension(const blink::WebString&);
95 virtual blink::WebString wellKnownMimeTypeForExtension(
96 const blink::WebString&);
97 virtual blink::WebString mimeTypeFromFile(const blink::WebString&);
98 virtual void queryStorageUsageAndQuota(
99 const blink::WebURL& storage_partition,
100 blink::WebStorageQuotaType,
101 blink::WebStorageQuotaCallbacks*) OVERRIDE;
103 WebDatabaseObserverImpl* web_database_observer_impl() {
104 return web_database_observer_impl_.get();
107 private:
109 class FileUtilities;
110 scoped_ptr<FileUtilities> file_utilities_;
111 scoped_ptr<blink::WebBlobRegistry> blob_registry_;
112 scoped_ptr<blink::WebIDBFactory> web_idb_factory_;
113 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
114 scoped_refptr<base::MessageLoopProxy> child_thread_loop_;
115 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
116 scoped_refptr<QuotaMessageFilter> quota_message_filter_;
117 scoped_ptr<WebDatabaseObserverImpl> web_database_observer_impl_;
120 } // namespace content
122 #endif // CONTENT_WORKER_WORKER_WEBKITPLATFORMSUPPORT_IMPL_H_