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" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 const WebString&) { | 257 const WebString&) { |
258 NOTREACHED(); | 258 NOTREACHED(); |
259 return WebMimeRegistry::IsSupported; | 259 return WebMimeRegistry::IsSupported; |
260 } | 260 } |
261 | 261 |
262 WebString WorkerWebKitPlatformSupportImpl::mimeTypeForExtension( | 262 WebString WorkerWebKitPlatformSupportImpl::mimeTypeForExtension( |
263 const WebString& file_extension) { | 263 const WebString& file_extension) { |
264 std::string mime_type; | 264 std::string mime_type; |
265 thread_safe_sender_->Send(new MimeRegistryMsg_GetMimeTypeFromExtension( | 265 thread_safe_sender_->Send(new MimeRegistryMsg_GetMimeTypeFromExtension( |
266 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type)); | 266 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type)); |
267 return ASCIIToUTF16(mime_type); | 267 return base::ASCIIToUTF16(mime_type); |
268 } | 268 } |
269 | 269 |
270 WebString WorkerWebKitPlatformSupportImpl::wellKnownMimeTypeForExtension( | 270 WebString WorkerWebKitPlatformSupportImpl::wellKnownMimeTypeForExtension( |
271 const WebString& file_extension) { | 271 const WebString& file_extension) { |
272 std::string mime_type; | 272 std::string mime_type; |
273 net::GetWellKnownMimeTypeFromExtension( | 273 net::GetWellKnownMimeTypeFromExtension( |
274 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type); | 274 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type); |
275 return ASCIIToUTF16(mime_type); | 275 return base::ASCIIToUTF16(mime_type); |
276 } | 276 } |
277 | 277 |
278 WebString WorkerWebKitPlatformSupportImpl::mimeTypeFromFile( | 278 WebString WorkerWebKitPlatformSupportImpl::mimeTypeFromFile( |
279 const WebString& file_path) { | 279 const WebString& file_path) { |
280 std::string mime_type; | 280 std::string mime_type; |
281 thread_safe_sender_->Send( | 281 thread_safe_sender_->Send( |
282 new MimeRegistryMsg_GetMimeTypeFromFile( | 282 new MimeRegistryMsg_GetMimeTypeFromFile( |
283 base::FilePath::FromUTF16Unsafe(file_path), | 283 base::FilePath::FromUTF16Unsafe(file_path), |
284 &mime_type)); | 284 &mime_type)); |
285 return ASCIIToUTF16(mime_type); | 285 return base::ASCIIToUTF16(mime_type); |
286 } | 286 } |
287 | 287 |
288 WebBlobRegistry* WorkerWebKitPlatformSupportImpl::blobRegistry() { | 288 WebBlobRegistry* WorkerWebKitPlatformSupportImpl::blobRegistry() { |
289 return blob_registry_.get(); | 289 return blob_registry_.get(); |
290 } | 290 } |
291 | 291 |
292 void WorkerWebKitPlatformSupportImpl::queryStorageUsageAndQuota( | 292 void WorkerWebKitPlatformSupportImpl::queryStorageUsageAndQuota( |
293 const blink::WebURL& storage_partition, | 293 const blink::WebURL& storage_partition, |
294 blink::WebStorageQuotaType type, | 294 blink::WebStorageQuotaType type, |
295 blink::WebStorageQuotaCallbacks* callbacks) { | 295 blink::WebStorageQuotaCallbacks* callbacks) { |
296 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) | 296 if (!thread_safe_sender_.get() || !quota_message_filter_.get()) |
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 |