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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 if (IsPluginProcess()) | 356 if (IsPluginProcess()) |
357 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); | 357 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); |
358 | 358 |
359 // The sandbox restricts our access to the registry, so we need to proxy | 359 // The sandbox restricts our access to the registry, so we need to proxy |
360 // these calls over to the browser process. | 360 // these calls over to the browser process. |
361 std::string mime_type; | 361 std::string mime_type; |
362 RenderThread::Get()->Send( | 362 RenderThread::Get()->Send( |
363 new MimeRegistryMsg_GetMimeTypeFromExtension( | 363 new MimeRegistryMsg_GetMimeTypeFromExtension( |
364 webkit_base::WebStringToFilePathString(file_extension), &mime_type)); | 364 webkit_base::WebStringToFilePathString(file_extension), &mime_type)); |
365 return ASCIIToUTF16(mime_type); | 365 return ASCIIToUTF16(mime_type); |
366 | |
367 } | 366 } |
368 | 367 |
369 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( | 368 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( |
370 const WebString& file_path) { | 369 const WebString& file_path) { |
371 if (IsPluginProcess()) | 370 if (IsPluginProcess()) |
372 return SimpleWebMimeRegistryImpl::mimeTypeFromFile(file_path); | 371 return SimpleWebMimeRegistryImpl::mimeTypeFromFile(file_path); |
373 | 372 |
374 // The sandbox restricts our access to the registry, so we need to proxy | 373 // The sandbox restricts our access to the registry, so we need to proxy |
375 // these calls over to the browser process. | 374 // these calls over to the browser process. |
376 std::string mime_type; | 375 std::string mime_type; |
377 RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( | 376 RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( |
378 FilePath(webkit_base::WebStringToFilePathString(file_path)), | 377 FilePath(webkit_base::WebStringToFilePathString(file_path)), |
379 &mime_type)); | 378 &mime_type)); |
380 return ASCIIToUTF16(mime_type); | 379 return ASCIIToUTF16(mime_type); |
381 | |
382 } | 380 } |
383 | 381 |
384 WebString | 382 WebString |
385 RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType( | 383 RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType( |
386 const WebString& mime_type) { | 384 const WebString& mime_type) { |
387 if (IsPluginProcess()) | 385 if (IsPluginProcess()) |
388 return SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType(mime_type); | 386 return SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType(mime_type); |
389 | 387 |
390 // The sandbox restricts our access to the registry, so we need to proxy | 388 // The sandbox restricts our access to the registry, so we need to proxy |
391 // these calls over to the browser process. | 389 // these calls over to the browser process. |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 656 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
659 gamepad_shared_memory_reader_->SampleGamepads(gamepads); | 657 gamepad_shared_memory_reader_->SampleGamepads(gamepads); |
660 } else { | 658 } else { |
661 gamepads = g_test_gamepads.Get(); | 659 gamepads = g_test_gamepads.Get(); |
662 return; | 660 return; |
663 } | 661 } |
664 } | 662 } |
665 | 663 |
666 WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent( | 664 WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent( |
667 const WebKit::WebURL& url) { | 665 const WebKit::WebURL& url) { |
668 return WebKitPlatformSupportImpl::userAgent(url); | 666 return WebKitPlatformSupportImpl::userAgent(url); |
669 } | 667 } |
670 | 668 |
671 void RendererWebKitPlatformSupportImpl::GetPlugins( | 669 void RendererWebKitPlatformSupportImpl::GetPlugins( |
672 bool refresh, std::vector<webkit::WebPluginInfo>* plugins) { | 670 bool refresh, std::vector<webkit::WebPluginInfo>* plugins) { |
673 #if defined(ENABLE_PLUGINS) | 671 #if defined(ENABLE_PLUGINS) |
674 if (!plugin_refresh_allowed_) | 672 if (!plugin_refresh_allowed_) |
675 refresh = false; | 673 refresh = false; |
676 RenderThread::Get()->Send( | 674 RenderThread::Get()->Send( |
677 new ViewHostMsg_GetPlugins(refresh, plugins)); | 675 new ViewHostMsg_GetPlugins(refresh, plugins)); |
678 #endif | 676 #endif |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 size_t before_index, | 751 size_t before_index, |
754 const WebKit::WebString& locale) { | 752 const WebKit::WebString& locale) { |
755 // Crash if WebKit calls this function when canHyphenate returns false. | 753 // Crash if WebKit calls this function when canHyphenate returns false. |
756 DCHECK(locale.isEmpty() || locale.equals("en-US")); | 754 DCHECK(locale.isEmpty() || locale.equals("en-US")); |
757 DCHECK(hyphenator_.get()); | 755 DCHECK(hyphenator_.get()); |
758 return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), | 756 return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), |
759 before_index); | 757 before_index); |
760 } | 758 } |
761 | 759 |
762 } // namespace content | 760 } // namespace content |
OLD | NEW |