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

Side by Side Diff: content/browser/renderer_host/file_utilities_message_filter.cc

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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/browser/renderer_host/file_utilities_message_filter.h" 5 #include "content/browser/renderer_host/file_utilities_message_filter.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "content/browser/child_process_security_policy_impl.h" 8 #include "content/browser/child_process_security_policy_impl.h"
9 #include "content/common/file_utilities_messages.h" 9 #include "content/common/file_utilities_messages.h"
10 10
(...skipping 18 matching lines...) Expand all
29 bool handled = true; 29 bool handled = true;
30 IPC_BEGIN_MESSAGE_MAP_EX(FileUtilitiesMessageFilter, message, *message_was_ok) 30 IPC_BEGIN_MESSAGE_MAP_EX(FileUtilitiesMessageFilter, message, *message_was_ok)
31 IPC_MESSAGE_HANDLER(FileUtilitiesMsg_GetFileInfo, OnGetFileInfo) 31 IPC_MESSAGE_HANDLER(FileUtilitiesMsg_GetFileInfo, OnGetFileInfo)
32 IPC_MESSAGE_UNHANDLED(handled = false) 32 IPC_MESSAGE_UNHANDLED(handled = false)
33 IPC_END_MESSAGE_MAP() 33 IPC_END_MESSAGE_MAP()
34 return handled; 34 return handled;
35 } 35 }
36 36
37 void FileUtilitiesMessageFilter::OnGetFileInfo( 37 void FileUtilitiesMessageFilter::OnGetFileInfo(
38 const base::FilePath& path, 38 const base::FilePath& path,
39 base::PlatformFileInfo* result, 39 base::File::Info* result,
40 base::PlatformFileError* status) { 40 base::File::Error* status) {
41 *result = base::PlatformFileInfo(); 41 *result = base::File::Info();
42 *status = base::PLATFORM_FILE_OK; 42 *status = base::File::FILE_OK;
43 43
44 // Get file metadata only when the child process has been granted 44 // Get file metadata only when the child process has been granted
45 // permission to read the file. 45 // permission to read the file.
46 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( 46 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile(
47 process_id_, path)) { 47 process_id_, path)) {
48 return; 48 return;
49 } 49 }
50 50
51 // TODO(rvargas): convert this code to use base::File. 51 if (!base::GetFileInfo(path, result))
52 if (!base::GetFileInfo(path, reinterpret_cast<base::File::Info*>(result))) 52 *status = base::File::FILE_ERROR_FAILED;
53 *status = base::PLATFORM_FILE_ERROR_FAILED;
54 } 53 }
55 54
56 } // namespace content 55 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698