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/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 331 |
332 // Let the browser know we generated cacheable metadata for this resource. The | 332 // Let the browser know we generated cacheable metadata for this resource. The |
333 // browser may cache it and return it on subsequent responses to speed | 333 // browser may cache it and return it on subsequent responses to speed |
334 // the processing of this resource. | 334 // the processing of this resource. |
335 std::vector<char> copy(data, data + size); | 335 std::vector<char> copy(data, data + size); |
336 RenderThread::Get()->Send( | 336 RenderThread::Get()->Send( |
337 new ViewHostMsg_DidGenerateCacheableMetadata(url, response_time, copy)); | 337 new ViewHostMsg_DidGenerateCacheableMetadata(url, response_time, copy)); |
338 } | 338 } |
339 | 339 |
340 WebString RendererWebKitPlatformSupportImpl::defaultLocale() { | 340 WebString RendererWebKitPlatformSupportImpl::defaultLocale() { |
341 return ASCIIToUTF16(RenderThread::Get()->GetLocale()); | 341 return base::ASCIIToUTF16(RenderThread::Get()->GetLocale()); |
342 } | 342 } |
343 | 343 |
344 void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) { | 344 void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) { |
345 if (enabled) { | 345 if (enabled) { |
346 // We should not get more enables than disables, but we want it to be a | 346 // We should not get more enables than disables, but we want it to be a |
347 // non-fatal error if it does happen. | 347 // non-fatal error if it does happen. |
348 DCHECK_GT(sudden_termination_disables_, 0); | 348 DCHECK_GT(sudden_termination_disables_, 0); |
349 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, | 349 sudden_termination_disables_ = std::max(sudden_termination_disables_ - 1, |
350 0); | 350 0); |
351 if (sudden_termination_disables_ != 0) | 351 if (sudden_termination_disables_ != 0) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 const WebString& file_extension) { | 449 const WebString& file_extension) { |
450 if (IsPluginProcess()) | 450 if (IsPluginProcess()) |
451 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); | 451 return SimpleWebMimeRegistryImpl::mimeTypeForExtension(file_extension); |
452 | 452 |
453 // The sandbox restricts our access to the registry, so we need to proxy | 453 // The sandbox restricts our access to the registry, so we need to proxy |
454 // these calls over to the browser process. | 454 // these calls over to the browser process. |
455 std::string mime_type; | 455 std::string mime_type; |
456 RenderThread::Get()->Send( | 456 RenderThread::Get()->Send( |
457 new MimeRegistryMsg_GetMimeTypeFromExtension( | 457 new MimeRegistryMsg_GetMimeTypeFromExtension( |
458 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type)); | 458 base::FilePath::FromUTF16Unsafe(file_extension).value(), &mime_type)); |
459 return ASCIIToUTF16(mime_type); | 459 return base::ASCIIToUTF16(mime_type); |
460 } | 460 } |
461 | 461 |
462 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( | 462 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( |
463 const WebString& file_path) { | 463 const WebString& file_path) { |
464 if (IsPluginProcess()) | 464 if (IsPluginProcess()) |
465 return SimpleWebMimeRegistryImpl::mimeTypeFromFile(file_path); | 465 return SimpleWebMimeRegistryImpl::mimeTypeFromFile(file_path); |
466 | 466 |
467 // The sandbox restricts our access to the registry, so we need to proxy | 467 // The sandbox restricts our access to the registry, so we need to proxy |
468 // these calls over to the browser process. | 468 // these calls over to the browser process. |
469 std::string mime_type; | 469 std::string mime_type; |
470 RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( | 470 RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( |
471 base::FilePath::FromUTF16Unsafe(file_path), | 471 base::FilePath::FromUTF16Unsafe(file_path), |
472 &mime_type)); | 472 &mime_type)); |
473 return ASCIIToUTF16(mime_type); | 473 return base::ASCIIToUTF16(mime_type); |
474 } | 474 } |
475 | 475 |
476 //------------------------------------------------------------------------------ | 476 //------------------------------------------------------------------------------ |
477 | 477 |
478 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo( | 478 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo( |
479 const WebString& path, | 479 const WebString& path, |
480 WebFileInfo& web_file_info) { | 480 WebFileInfo& web_file_info) { |
481 base::PlatformFileInfo file_info; | 481 base::PlatformFileInfo file_info; |
482 base::PlatformFileError status; | 482 base::PlatformFileError status; |
483 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( | 483 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 break; | 709 break; |
710 case 8: | 710 case 8: |
711 layout = media::CHANNEL_LAYOUT_7_1; | 711 layout = media::CHANNEL_LAYOUT_7_1; |
712 break; | 712 break; |
713 default: | 713 default: |
714 layout = media::CHANNEL_LAYOUT_STEREO; | 714 layout = media::CHANNEL_LAYOUT_STEREO; |
715 } | 715 } |
716 | 716 |
717 int session_id = 0; | 717 int session_id = 0; |
718 if (input_device_id.isNull() || | 718 if (input_device_id.isNull() || |
719 !base::StringToInt(UTF16ToUTF8(input_device_id), &session_id)) { | 719 !base::StringToInt(base::UTF16ToUTF8(input_device_id), &session_id)) { |
720 if (input_channels > 0) | 720 if (input_channels > 0) |
721 DLOG(WARNING) << "createAudioDevice(): request for audio input ignored"; | 721 DLOG(WARNING) << "createAudioDevice(): request for audio input ignored"; |
722 | 722 |
723 input_channels = 0; | 723 input_channels = 0; |
724 } | 724 } |
725 | 725 |
726 media::AudioParameters params( | 726 media::AudioParameters params( |
727 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 727 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
728 layout, input_channels, | 728 layout, input_channels, |
729 static_cast<int>(sample_rate), 16, buffer_size, | 729 static_cast<int>(sample_rate), 16, buffer_size, |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1073 return; | 1073 return; |
1074 QuotaDispatcher::ThreadSpecificInstance( | 1074 QuotaDispatcher::ThreadSpecificInstance( |
1075 thread_safe_sender_.get(), | 1075 thread_safe_sender_.get(), |
1076 quota_message_filter_.get())->QueryStorageUsageAndQuota( | 1076 quota_message_filter_.get())->QueryStorageUsageAndQuota( |
1077 storage_partition, | 1077 storage_partition, |
1078 static_cast<quota::StorageType>(type), | 1078 static_cast<quota::StorageType>(type), |
1079 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 1079 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
1080 } | 1080 } |
1081 | 1081 |
1082 } // namespace content | 1082 } // namespace content |
OLD | NEW |