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/renderer/renderer_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 WebKit::WebMimeRegistry* RendererWebKitPlatformSupportImpl::mimeRegistry() { | 221 WebKit::WebMimeRegistry* RendererWebKitPlatformSupportImpl::mimeRegistry() { |
222 WebKit::WebMimeRegistry* mime_registry = | 222 WebKit::WebMimeRegistry* mime_registry = |
223 GetContentClient()->renderer()->OverrideWebMimeRegistry(); | 223 GetContentClient()->renderer()->OverrideWebMimeRegistry(); |
224 if (mime_registry) | 224 if (mime_registry) |
225 return mime_registry; | 225 return mime_registry; |
226 return mime_registry_.get(); | 226 return mime_registry_.get(); |
227 } | 227 } |
228 | 228 |
229 WebKit::WebFileUtilities* | 229 WebKit::WebFileUtilities* |
230 RendererWebKitPlatformSupportImpl::fileUtilities() { | 230 RendererWebKitPlatformSupportImpl::fileUtilities() { |
231 if (!file_utilities_.get()) { | 231 if (!file_utilities_) { |
232 file_utilities_.reset(new FileUtilities(thread_safe_sender_)); | 232 file_utilities_.reset(new FileUtilities(thread_safe_sender_)); |
233 file_utilities_->set_sandbox_enabled(sandboxEnabled()); | 233 file_utilities_->set_sandbox_enabled(sandboxEnabled()); |
234 } | 234 } |
235 return file_utilities_.get(); | 235 return file_utilities_.get(); |
236 } | 236 } |
237 | 237 |
238 WebKit::WebSandboxSupport* RendererWebKitPlatformSupportImpl::sandboxSupport() { | 238 WebKit::WebSandboxSupport* RendererWebKitPlatformSupportImpl::sandboxSupport() { |
239 #if defined(OS_ANDROID) | 239 #if defined(OS_ANDROID) |
240 // WebKit doesn't use WebSandboxSupport on android. | 240 // WebKit doesn't use WebSandboxSupport on android. |
241 return NULL; | 241 return NULL; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 WebStorageNamespace* | 350 WebStorageNamespace* |
351 RendererWebKitPlatformSupportImpl::createLocalStorageNamespace( | 351 RendererWebKitPlatformSupportImpl::createLocalStorageNamespace( |
352 const WebString& path, unsigned quota) { | 352 const WebString& path, unsigned quota) { |
353 return new WebStorageNamespaceImpl(); | 353 return new WebStorageNamespaceImpl(); |
354 } | 354 } |
355 | 355 |
356 | 356 |
357 //------------------------------------------------------------------------------ | 357 //------------------------------------------------------------------------------ |
358 | 358 |
359 WebIDBFactory* RendererWebKitPlatformSupportImpl::idbFactory() { | 359 WebIDBFactory* RendererWebKitPlatformSupportImpl::idbFactory() { |
360 if (!web_idb_factory_.get()) { | 360 if (!web_idb_factory_) { |
361 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 361 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
362 web_idb_factory_.reset(WebIDBFactory::create()); | 362 web_idb_factory_.reset(WebIDBFactory::create()); |
363 else | 363 else |
364 web_idb_factory_.reset(new RendererWebIDBFactoryImpl()); | 364 web_idb_factory_.reset(new RendererWebIDBFactoryImpl()); |
365 } | 365 } |
366 return web_idb_factory_.get(); | 366 return web_idb_factory_.get(); |
367 } | 367 } |
368 | 368 |
369 //------------------------------------------------------------------------------ | 369 //------------------------------------------------------------------------------ |
370 | 370 |
371 WebFileSystem* RendererWebKitPlatformSupportImpl::fileSystem() { | 371 WebFileSystem* RendererWebKitPlatformSupportImpl::fileSystem() { |
372 if (!web_file_system_.get()) | 372 if (!web_file_system_) |
373 web_file_system_.reset(new WebFileSystemImpl()); | 373 web_file_system_.reset(new WebFileSystemImpl()); |
374 return web_file_system_.get(); | 374 return web_file_system_.get(); |
375 } | 375 } |
376 | 376 |
377 //------------------------------------------------------------------------------ | 377 //------------------------------------------------------------------------------ |
378 | 378 |
379 WebString | 379 WebString |
380 RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeForExtension( | 380 RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeForExtension( |
381 const WebString& file_extension) { | 381 const WebString& file_extension) { |
382 if (IsPluginProcess()) | 382 if (IsPluginProcess()) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 bool RendererWebKitPlatformSupportImpl::Hyphenator::canHyphenate( | 464 bool RendererWebKitPlatformSupportImpl::Hyphenator::canHyphenate( |
465 const WebKit::WebString& locale) { | 465 const WebKit::WebString& locale) { |
466 // Return false unless WebKit asks for US English dictionaries because WebKit | 466 // Return false unless WebKit asks for US English dictionaries because WebKit |
467 // can currently hyphenate only English words. | 467 // can currently hyphenate only English words. |
468 if (!locale.isEmpty() && !locale.equals("en-US")) | 468 if (!locale.isEmpty() && !locale.equals("en-US")) |
469 return false; | 469 return false; |
470 | 470 |
471 // Create a hyphenator object and attach it to the render thread so it can | 471 // Create a hyphenator object and attach it to the render thread so it can |
472 // receive a dictionary file opened by a browser. | 472 // receive a dictionary file opened by a browser. |
473 if (!hyphenator_.get()) { | 473 if (!hyphenator_) { |
474 hyphenator_.reset(new content::Hyphenator(base::kInvalidPlatformFileValue)); | 474 hyphenator_.reset(new content::Hyphenator(base::kInvalidPlatformFileValue)); |
475 if (!hyphenator_.get()) | 475 if (!hyphenator_) |
476 return false; | 476 return false; |
477 return hyphenator_->Attach(RenderThreadImpl::current(), locale); | 477 return hyphenator_->Attach(RenderThreadImpl::current(), locale); |
478 } | 478 } |
479 return hyphenator_->CanHyphenate(locale); | 479 return hyphenator_->CanHyphenate(locale); |
480 } | 480 } |
481 | 481 |
482 size_t RendererWebKitPlatformSupportImpl::Hyphenator::computeLastHyphenLocation( | 482 size_t RendererWebKitPlatformSupportImpl::Hyphenator::computeLastHyphenLocation( |
483 const char16* characters, | 483 const char16* characters, |
484 size_t length, | 484 size_t length, |
485 size_t before_index, | 485 size_t before_index, |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 std::vector<char> profile; | 752 std::vector<char> profile; |
753 RenderThread::Get()->Send( | 753 RenderThread::Get()->Send( |
754 new ViewHostMsg_GetMonitorColorProfile(&profile)); | 754 new ViewHostMsg_GetMonitorColorProfile(&profile)); |
755 *to_profile = profile; | 755 *to_profile = profile; |
756 } | 756 } |
757 | 757 |
758 //------------------------------------------------------------------------------ | 758 //------------------------------------------------------------------------------ |
759 | 759 |
760 WebBlobRegistry* RendererWebKitPlatformSupportImpl::blobRegistry() { | 760 WebBlobRegistry* RendererWebKitPlatformSupportImpl::blobRegistry() { |
761 // thread_safe_sender_ can be NULL when running some tests. | 761 // thread_safe_sender_ can be NULL when running some tests. |
762 if (!blob_registry_.get() && thread_safe_sender_.get()) | 762 if (!blob_registry_.get() && thread_safe_sender_) |
763 blob_registry_.reset(new WebBlobRegistryImpl(thread_safe_sender_)); | 763 blob_registry_.reset(new WebBlobRegistryImpl(thread_safe_sender_)); |
764 return blob_registry_.get(); | 764 return blob_registry_.get(); |
765 } | 765 } |
766 | 766 |
767 //------------------------------------------------------------------------------ | 767 //------------------------------------------------------------------------------ |
768 | 768 |
769 void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) { | 769 void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) { |
770 if (g_test_gamepads == 0) { | 770 if (g_test_gamepads == 0) { |
771 if (!gamepad_shared_memory_reader_.get()) | 771 if (!gamepad_shared_memory_reader_) |
772 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 772 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
773 gamepad_shared_memory_reader_->SampleGamepads(gamepads); | 773 gamepad_shared_memory_reader_->SampleGamepads(gamepads); |
774 } else { | 774 } else { |
775 gamepads = g_test_gamepads.Get(); | 775 gamepads = g_test_gamepads.Get(); |
776 return; | 776 return; |
777 } | 777 } |
778 } | 778 } |
779 | 779 |
780 WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent( | 780 WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent( |
781 const WebKit::WebURL& url) { | 781 const WebKit::WebURL& url) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 //------------------------------------------------------------------------------ | 890 //------------------------------------------------------------------------------ |
891 | 891 |
892 GrContext* RendererWebKitPlatformSupportImpl::sharedOffscreenGrContext() { | 892 GrContext* RendererWebKitPlatformSupportImpl::sharedOffscreenGrContext() { |
893 if (!shared_offscreen_context_) | 893 if (!shared_offscreen_context_) |
894 return NULL; | 894 return NULL; |
895 return shared_offscreen_context_->GrContext(); | 895 return shared_offscreen_context_->GrContext(); |
896 } | 896 } |
897 | 897 |
898 | 898 |
899 } // namespace content | 899 } // namespace content |
OLD | NEW |