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

Side by Side Diff: chrome/browser/media_galleries/fileapi/native_media_file_util.cc

Issue 1550593002: Switch to standard integer types in chrome/browser/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
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 "chrome/browser/media_galleries/fileapi/native_media_file_util.h" 5 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h"
6 6
7 #include <string> 7 #include <string>
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // static 75 // static
76 base::File::Error NativeMediaFileUtil::IsMediaFile( 76 base::File::Error NativeMediaFileUtil::IsMediaFile(
77 const base::FilePath& path) { 77 const base::FilePath& path) {
78 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ); 78 base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
79 if (!file.IsValid()) 79 if (!file.IsValid())
80 return file.error_details(); 80 return file.error_details();
81 81
82 char buffer[net::kMaxBytesToSniff]; 82 char buffer[net::kMaxBytesToSniff];
83 83
84 // Read as much as net::SniffMimeTypeFromLocalData() will bother looking at. 84 // Read as much as net::SniffMimeTypeFromLocalData() will bother looking at.
85 int64 len = file.Read(0, buffer, net::kMaxBytesToSniff); 85 int64_t len = file.Read(0, buffer, net::kMaxBytesToSniff);
86 if (len < 0) 86 if (len < 0)
87 return base::File::FILE_ERROR_FAILED; 87 return base::File::FILE_ERROR_FAILED;
88 88
89 return IsMediaHeader(buffer, len); 89 return IsMediaHeader(buffer, len);
90 } 90 }
91 91
92 // static 92 // static
93 base::File::Error NativeMediaFileUtil::BufferIsMediaHeader( 93 base::File::Error NativeMediaFileUtil::BufferIsMediaHeader(
94 net::IOBuffer* buf, size_t length) { 94 net::IOBuffer* buf, size_t length) {
95 return IsMediaHeader(buf->data(), length); 95 return IsMediaHeader(buf->data(), length);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 const base::Time& last_access_time, 199 const base::Time& last_access_time,
200 const base::Time& last_modified_time, 200 const base::Time& last_modified_time,
201 const StatusCallback& callback) { 201 const StatusCallback& callback) {
202 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 202 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
203 callback.Run(base::File::FILE_ERROR_SECURITY); 203 callback.Run(base::File::FILE_ERROR_SECURITY);
204 } 204 }
205 205
206 void NativeMediaFileUtil::Truncate( 206 void NativeMediaFileUtil::Truncate(
207 scoped_ptr<storage::FileSystemOperationContext> context, 207 scoped_ptr<storage::FileSystemOperationContext> context,
208 const storage::FileSystemURL& url, 208 const storage::FileSystemURL& url,
209 int64 length, 209 int64_t length,
210 const StatusCallback& callback) { 210 const StatusCallback& callback) {
211 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 211 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
212 callback.Run(base::File::FILE_ERROR_SECURITY); 212 callback.Run(base::File::FILE_ERROR_SECURITY);
213 } 213 }
214 214
215 void NativeMediaFileUtil::CopyFileLocal( 215 void NativeMediaFileUtil::CopyFileLocal(
216 scoped_ptr<storage::FileSystemOperationContext> context, 216 scoped_ptr<storage::FileSystemOperationContext> context,
217 const storage::FileSystemURL& src_url, 217 const storage::FileSystemURL& src_url,
218 const storage::FileSystemURL& dest_url, 218 const storage::FileSystemURL& dest_url,
219 CopyOrMoveOption option, 219 CopyOrMoveOption option,
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 return base::File::FILE_ERROR_FAILED; 670 return base::File::FILE_ERROR_FAILED;
671 671
672 if (!file_info.is_directory && 672 if (!file_info.is_directory &&
673 !media_path_filter_->Match(file_path)) { 673 !media_path_filter_->Match(file_path)) {
674 return failure_error; 674 return failure_error;
675 } 675 }
676 676
677 *local_file_path = file_path; 677 *local_file_path = file_path;
678 return base::File::FILE_OK; 678 return base::File::FILE_OK;
679 } 679 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698