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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
730 bool enable) { | 731 bool enable) { |
731 bool was_enabled = g_sandbox_enabled; | 732 bool was_enabled = g_sandbox_enabled; |
732 g_sandbox_enabled = enable; | 733 g_sandbox_enabled = enable; |
733 return was_enabled; | 734 return was_enabled; |
734 } | 735 } |
735 | 736 |
736 GpuChannelHostFactory* | 737 GpuChannelHostFactory* |
737 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 738 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
738 return RenderThreadImpl::current(); | 739 return RenderThreadImpl::current(); |
739 } | 740 } |
741 | |
742 //------------------------------------------------------------------------------ | |
743 | |
744 bool RendererWebKitPlatformSupportImpl::canHyphenate( | |
745 const WebKit::WebString& locale) { | |
746 // Return false unless WebKit asks for US English dictionaries because WebKit | |
747 // can currently hyphenate only English words. | |
748 if (!locale.isEmpty() && !locale.equals("en-US")) | |
749 return false; | |
750 | |
751 // Create a hyphenator object and attach it to the render thread so it can | |
752 // receive a dictionary file opened by a browser. (As of today, there are few | |
753 // pages that use the hyphens property and it is good to create this object | |
754 // only when WebKit finds a page that needs hyphenation.) | |
tony
2012/08/22 19:05:50
Nit: I would remove the sentence in ()s. I don't
Hironori Bono
2012/08/27 06:57:28
Done. Thanks for your suggestion.
| |
755 if (!hyphenator_.get()) { | |
756 hyphenator_.reset(new content::Hyphenator(base::kInvalidPlatformFileValue)); | |
757 if (!hyphenator_.get()) | |
758 return false; | |
759 return hyphenator_->Attach(RenderThreadImpl::current(), locale); | |
760 } | |
761 return hyphenator_->CanHyphenate(locale); | |
762 } | |
763 | |
764 size_t RendererWebKitPlatformSupportImpl::computeLastHyphenLocation( | |
765 const char16* characters, | |
766 size_t length, | |
767 size_t before_index, | |
768 const WebKit::WebString& locale) { | |
769 // Crash if WebKit calls this function when canHyphenate returns false. | |
770 DCHECK(locale.isEmpty() || locale.equals("en-US")); | |
771 DCHECK(hyphenator_.get()); | |
772 return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), | |
773 before_index); | |
774 } | |
OLD | NEW |