Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 10453037: Deprecate FileUtilities::getFileSize and getFileModifiedTime (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 public: 107 public:
108 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&); 108 virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&);
109 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&); 109 virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&);
110 virtual WebKit::WebString preferredExtensionForMIMEType( 110 virtual WebKit::WebString preferredExtensionForMIMEType(
111 const WebKit::WebString&); 111 const WebKit::WebString&);
112 }; 112 };
113 113
114 class RendererWebKitPlatformSupportImpl::FileUtilities 114 class RendererWebKitPlatformSupportImpl::FileUtilities
115 : public webkit_glue::WebFileUtilitiesImpl { 115 : public webkit_glue::WebFileUtilitiesImpl {
116 public: 116 public:
117 virtual bool getFileSize(const WebKit::WebString& path, long long& result);
118 virtual bool getFileModificationTime(const WebKit::WebString& path,
119 double& result);
120 virtual bool getFileInfo(const WebString& path, WebFileInfo& result); 117 virtual bool getFileInfo(const WebString& path, WebFileInfo& result);
121 virtual base::PlatformFile openFile(const WebKit::WebString& path, 118 virtual base::PlatformFile openFile(const WebKit::WebString& path,
122 int mode); 119 int mode);
123 }; 120 };
124 121
125 #if defined(OS_ANDROID) 122 #if defined(OS_ANDROID)
126 // 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
127 // implement anything here. 124 // implement anything here.
128 class RendererWebKitPlatformSupportImpl::SandboxSupport { 125 class RendererWebKitPlatformSupportImpl::SandboxSupport {
129 }; 126 };
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // these calls over to the browser process. 399 // these calls over to the browser process.
403 FilePath::StringType file_extension; 400 FilePath::StringType file_extension;
404 RenderThreadImpl::current()->Send( 401 RenderThreadImpl::current()->Send(
405 new MimeRegistryMsg_GetPreferredExtensionForMimeType( 402 new MimeRegistryMsg_GetPreferredExtensionForMimeType(
406 UTF16ToASCII(mime_type), &file_extension)); 403 UTF16ToASCII(mime_type), &file_extension));
407 return webkit_glue::FilePathStringToWebString(file_extension); 404 return webkit_glue::FilePathStringToWebString(file_extension);
408 } 405 }
409 406
410 //------------------------------------------------------------------------------ 407 //------------------------------------------------------------------------------
411 408
412 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileSize(
413 const WebString& path, long long& result) {
414 if (SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileSize(
415 webkit_glue::WebStringToFilePath(path),
416 reinterpret_cast<int64*>(&result)))) {
417 return result >= 0;
418 }
419
420 result = -1;
421 return false;
422 }
423
424 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileModificationTime(
425 const WebString& path,
426 double& result) {
427 base::Time time;
428 if (SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileModificationTime(
429 webkit_glue::WebStringToFilePath(path), &time))) {
430 result = time.ToDoubleT();
431 return !time.is_null();
432 }
433
434 result = 0;
435 return false;
436 }
437
438 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo( 409 bool RendererWebKitPlatformSupportImpl::FileUtilities::getFileInfo(
439 const WebString& path, 410 const WebString& path,
440 WebFileInfo& web_file_info) { 411 WebFileInfo& web_file_info) {
441 base::PlatformFileInfo file_info; 412 base::PlatformFileInfo file_info;
442 base::PlatformFileError status; 413 base::PlatformFileError status;
443 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo( 414 if (!SendSyncMessageFromAnyThread(new FileUtilitiesMsg_GetFileInfo(
444 webkit_glue::WebStringToFilePath(path), &file_info, &status)) || 415 webkit_glue::WebStringToFilePath(path), &file_info, &status)) ||
445 status != base::PLATFORM_FILE_OK) { 416 status != base::PLATFORM_FILE_OK) {
446 return false; 417 return false;
447 } 418 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 DCHECK(render_thread); 704 DCHECK(render_thread);
734 if (!render_thread) 705 if (!render_thread)
735 return NULL; 706 return NULL;
736 return render_thread->CreateMediaStreamCenter(client); 707 return render_thread->CreateMediaStreamCenter(client);
737 } 708 }
738 709
739 GpuChannelHostFactory* 710 GpuChannelHostFactory*
740 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { 711 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() {
741 return RenderThreadImpl::current(); 712 return RenderThreadImpl::current();
742 } 713 }
OLDNEW
« no previous file with comments | « content/common/file_utilities_messages.h ('k') | content/worker/worker_webkitplatformsupport_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698