| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/worker/worker_webkitplatformsupport_impl.h" | 5 #include "content/worker/worker_webkitplatformsupport_impl.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "content/child/blink_glue.h" |
| 12 #include "content/child/database_util.h" | 13 #include "content/child/database_util.h" |
| 13 #include "content/child/fileapi/webfilesystem_impl.h" | 14 #include "content/child/fileapi/webfilesystem_impl.h" |
| 14 #include "content/child/indexed_db/webidbfactory_impl.h" | 15 #include "content/child/indexed_db/webidbfactory_impl.h" |
| 15 #include "content/child/quota_dispatcher.h" | 16 #include "content/child/quota_dispatcher.h" |
| 16 #include "content/child/quota_message_filter.h" | 17 #include "content/child/quota_message_filter.h" |
| 17 #include "content/child/thread_safe_sender.h" | 18 #include "content/child/thread_safe_sender.h" |
| 18 #include "content/child/web_database_observer_impl.h" | 19 #include "content/child/web_database_observer_impl.h" |
| 19 #include "content/child/webblobregistry_impl.h" | 20 #include "content/child/webblobregistry_impl.h" |
| 21 #include "content/child/webfileutilities_impl.h" |
| 20 #include "content/child/webmessageportchannel_impl.h" | 22 #include "content/child/webmessageportchannel_impl.h" |
| 21 #include "content/common/file_utilities_messages.h" | 23 #include "content/common/file_utilities_messages.h" |
| 22 #include "content/common/mime_registry_messages.h" | 24 #include "content/common/mime_registry_messages.h" |
| 23 #include "content/worker/worker_thread.h" | 25 #include "content/worker/worker_thread.h" |
| 24 #include "ipc/ipc_sync_message_filter.h" | 26 #include "ipc/ipc_sync_message_filter.h" |
| 25 #include "net/base/mime_util.h" | 27 #include "net/base/mime_util.h" |
| 26 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" | 28 #include "third_party/WebKit/public/platform/WebBlobRegistry.h" |
| 27 #include "third_party/WebKit/public/platform/WebFileInfo.h" | 29 #include "third_party/WebKit/public/platform/WebFileInfo.h" |
| 28 #include "third_party/WebKit/public/platform/WebString.h" | 30 #include "third_party/WebKit/public/platform/WebString.h" |
| 29 #include "third_party/WebKit/public/platform/WebURL.h" | 31 #include "third_party/WebKit/public/platform/WebURL.h" |
| 30 #include "webkit/common/quota/quota_types.h" | 32 #include "webkit/common/quota/quota_types.h" |
| 31 #include "webkit/glue/webfileutilities_impl.h" | |
| 32 #include "webkit/glue/webkit_glue.h" | |
| 33 | 33 |
| 34 using blink::Platform; | 34 using blink::Platform; |
| 35 using blink::WebBlobRegistry; | 35 using blink::WebBlobRegistry; |
| 36 using blink::WebClipboard; | 36 using blink::WebClipboard; |
| 37 using blink::WebFileInfo; | 37 using blink::WebFileInfo; |
| 38 using blink::WebFileSystem; | 38 using blink::WebFileSystem; |
| 39 using blink::WebFileUtilities; | 39 using blink::WebFileUtilities; |
| 40 using blink::WebMessagePortChannel; | 40 using blink::WebMessagePortChannel; |
| 41 using blink::WebMimeRegistry; | 41 using blink::WebMimeRegistry; |
| 42 using blink::WebSandboxSupport; | 42 using blink::WebSandboxSupport; |
| 43 using blink::WebStorageNamespace; | 43 using blink::WebStorageNamespace; |
| 44 using blink::WebString; | 44 using blink::WebString; |
| 45 using blink::WebURL; | 45 using blink::WebURL; |
| 46 | 46 |
| 47 namespace content { | 47 namespace content { |
| 48 | 48 |
| 49 // TODO(kinuko): Probably this could be consolidated into | 49 // TODO(kinuko): Probably this could be consolidated into |
| 50 // RendererWebKitPlatformSupportImpl::FileUtilities. | 50 // RendererWebKitPlatformSupportImpl::FileUtilities. |
| 51 class WorkerWebKitPlatformSupportImpl::FileUtilities | 51 class WorkerWebKitPlatformSupportImpl::FileUtilities |
| 52 : public webkit_glue::WebFileUtilitiesImpl { | 52 : public WebFileUtilitiesImpl { |
| 53 public: | 53 public: |
| 54 explicit FileUtilities(ThreadSafeSender* sender) | 54 explicit FileUtilities(ThreadSafeSender* sender) |
| 55 : thread_safe_sender_(sender) {} | 55 : thread_safe_sender_(sender) {} |
| 56 virtual bool getFileInfo(const WebString& path, WebFileInfo& result); | 56 virtual bool getFileInfo(const WebString& path, WebFileInfo& result); |
| 57 private: | 57 private: |
| 58 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 58 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 bool WorkerWebKitPlatformSupportImpl::FileUtilities::getFileInfo( | 61 bool WorkerWebKitPlatformSupportImpl::FileUtilities::getFileInfo( |
| 62 const WebString& path, | 62 const WebString& path, |
| 63 WebFileInfo& web_file_info) { | 63 WebFileInfo& web_file_info) { |
| 64 base::File::Info file_info; | 64 base::File::Info file_info; |
| 65 base::File::Error status; | 65 base::File::Error status; |
| 66 if (!thread_safe_sender_.get() || | 66 if (!thread_safe_sender_.get() || |
| 67 !thread_safe_sender_->Send(new FileUtilitiesMsg_GetFileInfo( | 67 !thread_safe_sender_->Send(new FileUtilitiesMsg_GetFileInfo( |
| 68 base::FilePath::FromUTF16Unsafe(path), &file_info, &status)) || | 68 base::FilePath::FromUTF16Unsafe(path), &file_info, &status)) || |
| 69 status != base::File::FILE_OK) { | 69 status != base::File::FILE_OK) { |
| 70 return false; | 70 return false; |
| 71 } | 71 } |
| 72 webkit_glue::FileInfoToWebFileInfo(file_info, &web_file_info); | 72 FileInfoToWebFileInfo(file_info, &web_file_info); |
| 73 web_file_info.platformPath = path; | 73 web_file_info.platformPath = path; |
| 74 return true; | 74 return true; |
| 75 } | 75 } |
| 76 | 76 |
| 77 //------------------------------------------------------------------------------ | 77 //------------------------------------------------------------------------------ |
| 78 | 78 |
| 79 WorkerWebKitPlatformSupportImpl::WorkerWebKitPlatformSupportImpl( | 79 WorkerWebKitPlatformSupportImpl::WorkerWebKitPlatformSupportImpl( |
| 80 ThreadSafeSender* sender, | 80 ThreadSafeSender* sender, |
| 81 IPC::SyncMessageFilter* sync_message_filter, | 81 IPC::SyncMessageFilter* sync_message_filter, |
| 82 QuotaMessageFilter* quota_message_filter) | 82 QuotaMessageFilter* quota_message_filter) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 return; | 297 return; |
| 298 QuotaDispatcher::ThreadSpecificInstance( | 298 QuotaDispatcher::ThreadSpecificInstance( |
| 299 thread_safe_sender_.get(), | 299 thread_safe_sender_.get(), |
| 300 quota_message_filter_.get())->QueryStorageUsageAndQuota( | 300 quota_message_filter_.get())->QueryStorageUsageAndQuota( |
| 301 storage_partition, | 301 storage_partition, |
| 302 static_cast<quota::StorageType>(type), | 302 static_cast<quota::StorageType>(type), |
| 303 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 303 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // namespace content | 306 } // namespace content |
| OLD | NEW |