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_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "content/common/database_util.h" | 14 #include "content/common/database_util.h" |
15 #include "content/common/fileapi/webblobregistry_impl.h" | 15 #include "content/common/fileapi/webblobregistry_impl.h" |
16 #include "content/common/fileapi/webfilesystem_impl.h" | 16 #include "content/common/fileapi/webfilesystem_impl.h" |
17 #include "content/common/file_utilities_messages.h" | 17 #include "content/common/file_utilities_messages.h" |
18 #include "content/common/indexed_db/proxy_webidbfactory_impl.h" | 18 #include "content/common/indexed_db/proxy_webidbfactory_impl.h" |
19 #include "content/common/mime_registry_messages.h" | 19 #include "content/common/mime_registry_messages.h" |
20 #include "content/common/npobject_util.h" | 20 #include "content/common/npobject_util.h" |
21 #include "content/common/view_messages.h" | 21 #include "content/common/view_messages.h" |
22 #include "content/common/webmessageportchannel_impl.h" | 22 #include "content/common/webmessageportchannel_impl.h" |
23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
24 #include "content/public/common/gpu_info.h" | 24 #include "content/public/common/gpu_info.h" |
25 #include "content/public/renderer/content_renderer_client.h" | 25 #include "content/public/renderer/content_renderer_client.h" |
26 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 26 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
27 #include "content/renderer/gamepad_shared_memory_reader.h" | 27 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 28 #include "content/renderer/hyphenator/hyphenator.h" |
28 #include "content/renderer/media/audio_hardware.h" | 29 #include "content/renderer/media/audio_hardware.h" |
29 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | 30 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
30 #include "content/renderer/render_thread_impl.h" | 31 #include "content/renderer/render_thread_impl.h" |
31 #include "content/renderer/render_view_impl.h" | 32 #include "content/renderer/render_view_impl.h" |
32 #include "content/renderer/renderer_clipboard_client.h" | 33 #include "content/renderer/renderer_clipboard_client.h" |
33 #include "content/renderer/websharedworkerrepository_impl.h" | 34 #include "content/renderer/websharedworkerrepository_impl.h" |
34 #include "googleurl/src/gurl.h" | 35 #include "googleurl/src/gurl.h" |
35 #include "ipc/ipc_sync_message_filter.h" | 36 #include "ipc/ipc_sync_message_filter.h" |
36 #include "media/audio/audio_output_device.h" | 37 #include "media/audio/audio_output_device.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebBlobRegis
try.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebBlobRegis
try.h" |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 bool enable) { | 702 bool enable) { |
702 bool was_enabled = g_sandbox_enabled; | 703 bool was_enabled = g_sandbox_enabled; |
703 g_sandbox_enabled = enable; | 704 g_sandbox_enabled = enable; |
704 return was_enabled; | 705 return was_enabled; |
705 } | 706 } |
706 | 707 |
707 GpuChannelHostFactory* | 708 GpuChannelHostFactory* |
708 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 709 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
709 return RenderThreadImpl::current(); | 710 return RenderThreadImpl::current(); |
710 } | 711 } |
| 712 |
| 713 //------------------------------------------------------------------------------ |
| 714 |
| 715 bool RendererWebKitPlatformSupportImpl::canHyphenate( |
| 716 const WebKit::WebString& locale) { |
| 717 // Return false unless WebKit asks for US English dictionaries because WebKit |
| 718 // can currently hyphenate only English words. |
| 719 if (!locale.isEmpty() && !locale.equals("en-US")) |
| 720 return false; |
| 721 |
| 722 // Create a hyphenator object and attach it to the render thread so it can |
| 723 // receive a dictionary file opened by a browser. |
| 724 if (!hyphenator_.get()) { |
| 725 hyphenator_.reset(new content::Hyphenator(base::kInvalidPlatformFileValue)); |
| 726 if (!hyphenator_.get()) |
| 727 return false; |
| 728 return hyphenator_->Attach(RenderThreadImpl::current(), locale); |
| 729 } |
| 730 return hyphenator_->CanHyphenate(locale); |
| 731 } |
| 732 |
| 733 size_t RendererWebKitPlatformSupportImpl::computeLastHyphenLocation( |
| 734 const char16* characters, |
| 735 size_t length, |
| 736 size_t before_index, |
| 737 const WebKit::WebString& locale) { |
| 738 // Crash if WebKit calls this function when canHyphenate returns false. |
| 739 DCHECK(locale.isEmpty() || locale.equals("en-US")); |
| 740 DCHECK(hyphenator_.get()); |
| 741 return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), |
| 742 before_index); |
| 743 } |
OLD | NEW |