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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 366 |
367 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( | 367 WebString RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeFromFile( |
368 const WebString& file_path) { | 368 const WebString& file_path) { |
369 if (IsPluginProcess()) | 369 if (IsPluginProcess()) |
370 return SimpleWebMimeRegistryImpl::mimeTypeFromFile(file_path); | 370 return SimpleWebMimeRegistryImpl::mimeTypeFromFile(file_path); |
371 | 371 |
372 // The sandbox restricts our access to the registry, so we need to proxy | 372 // The sandbox restricts our access to the registry, so we need to proxy |
373 // these calls over to the browser process. | 373 // these calls over to the browser process. |
374 std::string mime_type; | 374 std::string mime_type; |
375 RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( | 375 RenderThread::Get()->Send(new MimeRegistryMsg_GetMimeTypeFromFile( |
376 FilePath(webkit_base::WebStringToFilePathString(file_path)), | 376 base::FilePath(webkit_base::WebStringToFilePathString(file_path)), |
377 &mime_type)); | 377 &mime_type)); |
378 return ASCIIToUTF16(mime_type); | 378 return ASCIIToUTF16(mime_type); |
379 } | 379 } |
380 | 380 |
381 WebString | 381 WebString |
382 RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType( | 382 RendererWebKitPlatformSupportImpl::MimeRegistry::preferredExtensionForMIMEType( |
383 const WebString& mime_type) { | 383 const WebString& mime_type) { |
384 if (IsPluginProcess()) | 384 if (IsPluginProcess()) |
385 return SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType(mime_type); | 385 return SimpleWebMimeRegistryImpl::preferredExtensionForMIMEType(mime_type); |
386 | 386 |
387 // The sandbox restricts our access to the registry, so we need to proxy | 387 // The sandbox restricts our access to the registry, so we need to proxy |
388 // these calls over to the browser process. | 388 // these calls over to the browser process. |
389 FilePath::StringType file_extension; | 389 base::FilePath::StringType file_extension; |
390 RenderThread::Get()->Send( | 390 RenderThread::Get()->Send( |
391 new MimeRegistryMsg_GetPreferredExtensionForMimeType( | 391 new MimeRegistryMsg_GetPreferredExtensionForMimeType( |
392 UTF16ToASCII(mime_type), &file_extension)); | 392 UTF16ToASCII(mime_type), &file_extension)); |
393 return webkit_base::FilePathStringToWebString(file_extension); | 393 return webkit_base::FilePathStringToWebString(file_extension); |
394 } | 394 } |
395 | 395 |
396 //------------------------------------------------------------------------------ | 396 //------------------------------------------------------------------------------ |
397 | 397 |
398 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo( | 398 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo( |
399 const WebString& path, | 399 const WebString& path, |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 //------------------------------------------------------------------------------ | 773 //------------------------------------------------------------------------------ |
774 | 774 |
775 bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes( | 775 bool RendererWebKitPlatformSupportImpl::processMemorySizesInBytes( |
776 size_t* private_bytes, size_t* shared_bytes) { | 776 size_t* private_bytes, size_t* shared_bytes) { |
777 content::RenderThread::Get()->Send( | 777 content::RenderThread::Get()->Send( |
778 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes)); | 778 new ViewHostMsg_GetProcessMemorySizes(private_bytes, shared_bytes)); |
779 return true; | 779 return true; |
780 } | 780 } |
781 | 781 |
782 } // namespace content | 782 } // namespace content |
OLD | NEW |