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 <algorithm> | |
8 #include <vector> | |
Chris Rogers
2012/06/25 20:05:17
Not sure if this or the other changes in this file
henrika (OOO until Aug 14)
2012/06/26 11:17:27
I removed this file from the CL.
| |
9 | |
7 #include "base/command_line.h" | 10 #include "base/command_line.h" |
8 #include "base/file_path.h" | 11 #include "base/file_path.h" |
9 #include "base/file_util.h" | 12 #include "base/file_util.h" |
10 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
11 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
12 #include "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
13 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
14 #include "content/common/database_util.h" | 17 #include "content/common/database_util.h" |
15 #include "content/common/fileapi/webblobregistry_impl.h" | 18 #include "content/common/fileapi/webblobregistry_impl.h" |
16 #include "content/common/fileapi/webfilesystem_impl.h" | 19 #include "content/common/fileapi/webfilesystem_impl.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
336 WebIDBFactory* RendererWebKitPlatformSupportImpl::idbFactory() { | 339 WebIDBFactory* RendererWebKitPlatformSupportImpl::idbFactory() { |
337 if (!web_idb_factory_.get()) { | 340 if (!web_idb_factory_.get()) { |
338 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 341 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
339 web_idb_factory_.reset(WebIDBFactory::create()); | 342 web_idb_factory_.reset(WebIDBFactory::create()); |
340 else | 343 else |
341 web_idb_factory_.reset(new RendererWebIDBFactoryImpl()); | 344 web_idb_factory_.reset(new RendererWebIDBFactoryImpl()); |
342 } | 345 } |
343 return web_idb_factory_.get(); | 346 return web_idb_factory_.get(); |
344 } | 347 } |
345 | 348 |
346 void RendererWebKitPlatformSupportImpl::createIDBKeysFromSerializedValuesAndKeyP ath( | 349 void |
350 RendererWebKitPlatformSupportImpl::createIDBKeysFromSerializedValuesAndKeyPath( | |
347 const WebVector<WebSerializedScriptValue>& values, | 351 const WebVector<WebSerializedScriptValue>& values, |
348 const WebIDBKeyPath& keyPath, | 352 const WebIDBKeyPath& keyPath, |
349 WebVector<WebIDBKey>& keys_out) { | 353 WebVector<WebIDBKey>& keys_out) { |
350 DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); | 354 DCHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)); |
351 WebVector<WebIDBKey> keys(values.size()); | 355 WebVector<WebIDBKey> keys(values.size()); |
352 for (size_t i = 0; i < values.size(); ++i) { | 356 for (size_t i = 0; i < values.size(); ++i) { |
353 keys[i] = WebIDBKey::createFromValueAndKeyPath( | 357 keys[i] = WebIDBKey::createFromValueAndKeyPath( |
354 values[i], keyPath); | 358 values[i], keyPath); |
355 } | 359 } |
356 keys_out.swap(keys); | 360 keys_out.swap(keys); |
(...skipping 25 matching lines...) Expand all Loading... | |
382 if (IsPluginProcess()) | 386 if (IsPluginProcess()) |
383 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); | 387 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); |
384 | 388 |
385 // The sandbox restricts our access to the registry, so we need to proxy | 389 // The sandbox restricts our access to the registry, so we need to proxy |
386 // these calls over to the browser process. | 390 // these calls over to the browser process. |
387 std::string mime_type; | 391 std::string mime_type; |
388 RenderThreadImpl::current()->Send( | 392 RenderThreadImpl::current()->Send( |
389 new MimeRegistryMsg_GetMimeTypeFromExtension( | 393 new MimeRegistryMsg_GetMimeTypeFromExtension( |
390 webkit_glue::WebStringToFilePathString(file_extension), &mime_type)); | 394 webkit_glue::WebStringToFilePathString(file_extension), &mime_type)); |
391 return ASCIIToUTF16(mime_type); | 395 return ASCIIToUTF16(mime_type); |
392 | |
393 } | 396 } |
394 | 397 |
395 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( | 398 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( |
396 const WebString& file_path) { | 399 const WebString& file_path) { |
397 if (IsPluginProcess()) | 400 if (IsPluginProcess()) |
398 return SimpleWebMimeRegistryImpl::mimeTypeFromFile(file_path); | 401 return SimpleWebMimeRegistryImpl::mimeTypeFromFile(file_path); |
399 | 402 |
400 // The sandbox restricts our access to the registry, so we need to proxy | 403 // The sandbox restricts our access to the registry, so we need to proxy |
401 // these calls over to the browser process. | 404 // these calls over to the browser process. |
402 std::string mime_type; | 405 std::string mime_type; |
403 RenderThreadImpl::current()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( | 406 RenderThreadImpl::current()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( |
404 FilePath(webkit_glue::WebStringToFilePathString(file_path)), | 407 FilePath(webkit_glue::WebStringToFilePathString(file_path)), |
405 &mime_type)); | 408 &mime_type)); |
406 return ASCIIToUTF16(mime_type); | 409 return ASCIIToUTF16(mime_type); |
407 | |
408 } | 410 } |
409 | 411 |
410 WebString | 412 WebString |
411 RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType( | 413 RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType( |
412 const WebString& mime_type) { | 414 const WebString& mime_type) { |
413 if (IsPluginProcess()) | 415 if (IsPluginProcess()) |
414 return SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType(mime_type); | 416 return SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType(mime_type); |
415 | 417 |
416 // The sandbox restricts our access to the registry, so we need to proxy | 418 // The sandbox restricts our access to the registry, so we need to proxy |
417 // these calls over to the browser process. | 419 // these calls over to the browser process. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 //------------------------------------------------------------------------------ | 671 //------------------------------------------------------------------------------ |
670 | 672 |
671 void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) { | 673 void RendererWebKitPlatformSupportImpl::sampleGamepads(WebGamepads& gamepads) { |
672 if (!gamepad_shared_memory_reader_.get()) | 674 if (!gamepad_shared_memory_reader_.get()) |
673 gamepad_shared_memory_reader_.reset(new content::GamepadSharedMemoryReader); | 675 gamepad_shared_memory_reader_.reset(new content::GamepadSharedMemoryReader); |
674 gamepad_shared_memory_reader_->SampleGamepads(gamepads); | 676 gamepad_shared_memory_reader_->SampleGamepads(gamepads); |
675 } | 677 } |
676 | 678 |
677 WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent( | 679 WebKit::WebString RendererWebKitPlatformSupportImpl::userAgent( |
678 const WebKit::WebURL& url) { | 680 const WebKit::WebURL& url) { |
679 return WebKitPlatformSupportImpl::userAgent(url); | 681 return WebKitPlatformSupportImpl::userAgent(url); |
680 } | 682 } |
681 | 683 |
682 void RendererWebKitPlatformSupportImpl::GetPlugins( | 684 void RendererWebKitPlatformSupportImpl::GetPlugins( |
683 bool refresh, std::vector<webkit::WebPluginInfo>* plugins) { | 685 bool refresh, std::vector<webkit::WebPluginInfo>* plugins) { |
684 if (!RenderThreadImpl::current()->plugin_refresh_allowed()) | 686 if (!RenderThreadImpl::current()->plugin_refresh_allowed()) |
685 refresh = false; | 687 refresh = false; |
686 RenderThreadImpl::current()->Send( | 688 RenderThreadImpl::current()->Send( |
687 new ViewHostMsg_GetPlugins(refresh, plugins)); | 689 new ViewHostMsg_GetPlugins(refresh, plugins)); |
688 } | 690 } |
689 | 691 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
730 bool enable) { | 732 bool enable) { |
731 bool was_enabled = g_sandbox_enabled; | 733 bool was_enabled = g_sandbox_enabled; |
732 g_sandbox_enabled = enable; | 734 g_sandbox_enabled = enable; |
733 return was_enabled; | 735 return was_enabled; |
734 } | 736 } |
735 | 737 |
736 GpuChannelHostFactory* | 738 GpuChannelHostFactory* |
737 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 739 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
738 return RenderThreadImpl::current(); | 740 return RenderThreadImpl::current(); |
739 } | 741 } |
OLD | NEW |