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

Side by Side Diff: chrome/browser/chromeos/drive/local_file_reader.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, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/local_file_reader.h" 5 #include "chrome/browser/chromeos/drive/local_file_reader.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 23 matching lines...) Expand all
34 34
35 // First of all, open the file. 35 // First of all, open the file.
36 const int open_flags = base::PLATFORM_FILE_OPEN | 36 const int open_flags = base::PLATFORM_FILE_OPEN |
37 base::PLATFORM_FILE_READ | 37 base::PLATFORM_FILE_READ |
38 base::PLATFORM_FILE_ASYNC; 38 base::PLATFORM_FILE_ASYNC;
39 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; 39 base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
40 base::PlatformFile file = 40 base::PlatformFile file =
41 base::CreatePlatformFile(file_path, open_flags, NULL, &error); 41 base::CreatePlatformFile(file_path, open_flags, NULL, &error);
42 if (file == base::kInvalidPlatformFileValue) { 42 if (file == base::kInvalidPlatformFileValue) {
43 DCHECK_NE(base::PLATFORM_FILE_OK, error); 43 DCHECK_NE(base::PLATFORM_FILE_OK, error);
44 return net::PlatformFileErrorToNetError(error); 44 return net::FileErrorToNetError(static_cast<base::File::Error>(error));
45 } 45 }
46 46
47 // If succeeded, seek to the |offset| from begin. 47 // If succeeded, seek to the |offset| from begin.
48 int64 position = base::SeekPlatformFile( 48 int64 position = base::SeekPlatformFile(
49 file, base::PLATFORM_FILE_FROM_BEGIN, offset); 49 file, base::PLATFORM_FILE_FROM_BEGIN, offset);
50 if (position < 0) { 50 if (position < 0) {
51 // If failed, close the file and return an error. 51 // If failed, close the file and return an error.
52 base::ClosePlatformFile(file); 52 base::ClosePlatformFile(file);
53 return net::ERR_FAILED; 53 return net::ERR_FAILED;
54 } 54 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (open_result == net::OK) { 168 if (open_result == net::OK) {
169 DCHECK_NE(base::kInvalidPlatformFileValue, *platform_file->ptr()); 169 DCHECK_NE(base::kInvalidPlatformFileValue, *platform_file->ptr());
170 platform_file_ = platform_file->release(); 170 platform_file_ = platform_file->release();
171 } 171 }
172 172
173 callback.Run(open_result); 173 callback.Run(open_result);
174 } 174 }
175 175
176 } // namespace util 176 } // namespace util
177 } // namespace drive 177 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/fileapi_worker_unittest.cc ('k') | chrome/browser/chromeos/drive/resource_entry_conversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698