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/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 public: | 105 public: |
106 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); | 106 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); |
107 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); | 107 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); |
108 virtual WebKit::WebString preferredExtensionForMIMEType( | 108 virtual WebKit::WebString preferredExtensionForMIMEType( |
109 const WebKit::WebString&); | 109 const WebKit::WebString&); |
110 }; | 110 }; |
111 | 111 |
112 class RendererWebKitPlatformSupportImpl::FileUtilities | 112 class RendererWebKitPlatformSupportImpl::FileUtilities |
113 : public webkit_glue::WebFileUtilitiesImpl { | 113 : public webkit_glue::WebFileUtilitiesImpl { |
114 public: | 114 public: |
115 virtual void revealFolderInOS(const WebKit::WebString& path); | |
116 virtual bool getFileSize(const WebKit::WebString& path, long long& result); | 115 virtual bool getFileSize(const WebKit::WebString& path, long long& result); |
117 virtual bool getFileModificationTime(const WebKit::WebString& path, | 116 virtual bool getFileModificationTime(const WebKit::WebString& path, |
118 double& result); | 117 double& result); |
119 virtual base::PlatformFile openFile(const WebKit::WebString& path, | 118 virtual base::PlatformFile openFile(const WebKit::WebString& path, |
120 int mode); | 119 int mode); |
121 }; | 120 }; |
122 | 121 |
123 #if defined(OS_ANDROID) | 122 #if defined(OS_ANDROID) |
124 // WebKit doesn't use WebSandboxSupport on android so we don't need to | 123 // WebKit doesn't use WebSandboxSupport on android so we don't need to |
125 // implement anything here. | 124 // implement anything here. |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 if (SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileSize( | 411 if (SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileSize( |
413 webkit_glue::WebStringToFilePath(path), | 412 webkit_glue::WebStringToFilePath(path), |
414 reinterpret_cast<int64*>(&result)))) { | 413 reinterpret_cast<int64*>(&result)))) { |
415 return result >= 0; | 414 return result >= 0; |
416 } | 415 } |
417 | 416 |
418 result = -1; | 417 result = -1; |
419 return false; | 418 return false; |
420 } | 419 } |
421 | 420 |
422 void RendererWebKitPlatformSupportImpl::FileUtilities::revealFolderInOS( | |
423 const WebString& path) { | |
424 FilePath file_path(webkit_glue::WebStringToFilePath(path)); | |
425 bool res = file_util::AbsolutePath(&file_path); | |
426 DCHECK(res); | |
427 RenderThreadImpl::current()->Send( | |
428 new FileUtilitiesMsg_RevealFolderInOS(file_path)); | |
429 } | |
430 | |
431 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileModificationTime( | 421 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileModificationTime( |
432 const WebString& path, | 422 const WebString& path, |
433 double& result) { | 423 double& result) { |
434 base::Time time; | 424 base::Time time; |
435 if (SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileModificationTime( | 425 if (SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileModificationTime( |
436 webkit_glue::WebStringToFilePath(path), &time))) { | 426 webkit_glue::WebStringToFilePath(path), &time))) { |
437 result = time.ToDoubleT(); | 427 result = time.ToDoubleT(); |
438 return !time.is_null(); | 428 return !time.is_null(); |
439 } | 429 } |
440 | 430 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 DCHECK(render_thread); | 715 DCHECK(render_thread); |
726 if (!render_thread) | 716 if (!render_thread) |
727 return NULL; | 717 return NULL; |
728 return render_thread->CreateMediaStreamCenter(client); | 718 return render_thread->CreateMediaStreamCenter(client); |
729 } | 719 } |
730 | 720 |
731 GpuChannelHostFactory* | 721 GpuChannelHostFactory* |
732 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 722 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
733 return RenderThreadImpl::current(); | 723 return RenderThreadImpl::current(); |
734 } | 724 } |
OLD | NEW |