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

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

Issue 18580012: Cleanup: return value and null-callback fixups on AsyncFileUtil interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment fix Created 7 years, 5 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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "webkit/browser/fileapi/async_file_util.h" 10 #include "webkit/browser/fileapi/async_file_util.h"
11 11
12 namespace chrome { 12 namespace chrome {
13 13
14 // This class handles native file system operations with media type filtering. 14 // This class handles native file system operations with media type filtering.
15 // To support virtual file systems it implements the AsyncFileUtil interface 15 // To support virtual file systems it implements the AsyncFileUtil interface
16 // from scratch and provides synchronous override points. 16 // from scratch and provides synchronous override points.
17 class NativeMediaFileUtil : public fileapi::AsyncFileUtil { 17 class NativeMediaFileUtil : public fileapi::AsyncFileUtil {
18 public: 18 public:
19 NativeMediaFileUtil(); 19 NativeMediaFileUtil();
20 virtual ~NativeMediaFileUtil(); 20 virtual ~NativeMediaFileUtil();
21 21
22 // Uses the MIME sniffer code, which actually looks into the file, 22 // Uses the MIME sniffer code, which actually looks into the file,
23 // to determine if it is really a media file (to avoid exposing 23 // to determine if it is really a media file (to avoid exposing
24 // non-media files with a media file extension.) 24 // non-media files with a media file extension.)
25 static base::PlatformFileError IsMediaFile(const base::FilePath& path); 25 static base::PlatformFileError IsMediaFile(const base::FilePath& path);
26 26
27 // AsyncFileUtil overrides. 27 // AsyncFileUtil overrides.
28 virtual bool CreateOrOpen( 28 virtual void CreateOrOpen(
29 scoped_ptr<fileapi::FileSystemOperationContext> context, 29 scoped_ptr<fileapi::FileSystemOperationContext> context,
30 const fileapi::FileSystemURL& url, 30 const fileapi::FileSystemURL& url,
31 int file_flags, 31 int file_flags,
32 const CreateOrOpenCallback& callback) OVERRIDE; 32 const CreateOrOpenCallback& callback) OVERRIDE;
33 virtual bool EnsureFileExists( 33 virtual void EnsureFileExists(
34 scoped_ptr<fileapi::FileSystemOperationContext> context, 34 scoped_ptr<fileapi::FileSystemOperationContext> context,
35 const fileapi::FileSystemURL& url, 35 const fileapi::FileSystemURL& url,
36 const EnsureFileExistsCallback& callback) OVERRIDE; 36 const EnsureFileExistsCallback& callback) OVERRIDE;
37 virtual bool CreateDirectory( 37 virtual void CreateDirectory(
38 scoped_ptr<fileapi::FileSystemOperationContext> context, 38 scoped_ptr<fileapi::FileSystemOperationContext> context,
39 const fileapi::FileSystemURL& url, 39 const fileapi::FileSystemURL& url,
40 bool exclusive, 40 bool exclusive,
41 bool recursive, 41 bool recursive,
42 const StatusCallback& callback) OVERRIDE; 42 const StatusCallback& callback) OVERRIDE;
43 virtual bool GetFileInfo( 43 virtual void GetFileInfo(
44 scoped_ptr<fileapi::FileSystemOperationContext> context, 44 scoped_ptr<fileapi::FileSystemOperationContext> context,
45 const fileapi::FileSystemURL& url, 45 const fileapi::FileSystemURL& url,
46 const GetFileInfoCallback& callback) OVERRIDE; 46 const GetFileInfoCallback& callback) OVERRIDE;
47 virtual bool ReadDirectory( 47 virtual void ReadDirectory(
48 scoped_ptr<fileapi::FileSystemOperationContext> context, 48 scoped_ptr<fileapi::FileSystemOperationContext> context,
49 const fileapi::FileSystemURL& url, 49 const fileapi::FileSystemURL& url,
50 const ReadDirectoryCallback& callback) OVERRIDE; 50 const ReadDirectoryCallback& callback) OVERRIDE;
51 virtual bool Touch( 51 virtual void Touch(
52 scoped_ptr<fileapi::FileSystemOperationContext> context, 52 scoped_ptr<fileapi::FileSystemOperationContext> context,
53 const fileapi::FileSystemURL& url, 53 const fileapi::FileSystemURL& url,
54 const base::Time& last_access_time, 54 const base::Time& last_access_time,
55 const base::Time& last_modified_time, 55 const base::Time& last_modified_time,
56 const StatusCallback& callback) OVERRIDE; 56 const StatusCallback& callback) OVERRIDE;
57 virtual bool Truncate( 57 virtual void Truncate(
58 scoped_ptr<fileapi::FileSystemOperationContext> context, 58 scoped_ptr<fileapi::FileSystemOperationContext> context,
59 const fileapi::FileSystemURL& url, 59 const fileapi::FileSystemURL& url,
60 int64 length, 60 int64 length,
61 const StatusCallback& callback) OVERRIDE; 61 const StatusCallback& callback) OVERRIDE;
62 virtual bool CopyFileLocal( 62 virtual void CopyFileLocal(
63 scoped_ptr<fileapi::FileSystemOperationContext> context, 63 scoped_ptr<fileapi::FileSystemOperationContext> context,
64 const fileapi::FileSystemURL& src_url, 64 const fileapi::FileSystemURL& src_url,
65 const fileapi::FileSystemURL& dest_url, 65 const fileapi::FileSystemURL& dest_url,
66 const StatusCallback& callback) OVERRIDE; 66 const StatusCallback& callback) OVERRIDE;
67 virtual bool MoveFileLocal( 67 virtual void MoveFileLocal(
68 scoped_ptr<fileapi::FileSystemOperationContext> context, 68 scoped_ptr<fileapi::FileSystemOperationContext> context,
69 const fileapi::FileSystemURL& src_url, 69 const fileapi::FileSystemURL& src_url,
70 const fileapi::FileSystemURL& dest_url, 70 const fileapi::FileSystemURL& dest_url,
71 const StatusCallback& callback) OVERRIDE; 71 const StatusCallback& callback) OVERRIDE;
72 virtual bool CopyInForeignFile( 72 virtual void CopyInForeignFile(
73 scoped_ptr<fileapi::FileSystemOperationContext> context, 73 scoped_ptr<fileapi::FileSystemOperationContext> context,
74 const base::FilePath& src_file_path, 74 const base::FilePath& src_file_path,
75 const fileapi::FileSystemURL& dest_url, 75 const fileapi::FileSystemURL& dest_url,
76 const StatusCallback& callback) OVERRIDE; 76 const StatusCallback& callback) OVERRIDE;
77 virtual bool DeleteFile( 77 virtual void DeleteFile(
78 scoped_ptr<fileapi::FileSystemOperationContext> context, 78 scoped_ptr<fileapi::FileSystemOperationContext> context,
79 const fileapi::FileSystemURL& url, 79 const fileapi::FileSystemURL& url,
80 const StatusCallback& callback) OVERRIDE; 80 const StatusCallback& callback) OVERRIDE;
81 virtual bool DeleteDirectory( 81 virtual void DeleteDirectory(
82 scoped_ptr<fileapi::FileSystemOperationContext> context, 82 scoped_ptr<fileapi::FileSystemOperationContext> context,
83 const fileapi::FileSystemURL& url, 83 const fileapi::FileSystemURL& url,
84 const StatusCallback& callback) OVERRIDE; 84 const StatusCallback& callback) OVERRIDE;
85 virtual bool DeleteRecursively( 85 virtual void DeleteRecursively(
86 scoped_ptr<fileapi::FileSystemOperationContext> context, 86 scoped_ptr<fileapi::FileSystemOperationContext> context,
87 const fileapi::FileSystemURL& url, 87 const fileapi::FileSystemURL& url,
88 const StatusCallback& callback) OVERRIDE; 88 const StatusCallback& callback) OVERRIDE;
89 virtual bool CreateSnapshotFile( 89 virtual void CreateSnapshotFile(
90 scoped_ptr<fileapi::FileSystemOperationContext> context, 90 scoped_ptr<fileapi::FileSystemOperationContext> context,
91 const fileapi::FileSystemURL& url, 91 const fileapi::FileSystemURL& url,
92 const CreateSnapshotFileCallback& callback) OVERRIDE; 92 const CreateSnapshotFileCallback& callback) OVERRIDE;
93 93
94 protected: 94 protected:
95 virtual void CreateDirectoryOnTaskRunnerThread( 95 virtual void CreateDirectoryOnTaskRunnerThread(
96 scoped_ptr<fileapi::FileSystemOperationContext> context, 96 scoped_ptr<fileapi::FileSystemOperationContext> context,
97 const fileapi::FileSystemURL& url, 97 const fileapi::FileSystemURL& url,
98 bool exclusive, 98 bool exclusive,
99 bool recursive, 99 bool recursive,
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 193
194 base::WeakPtrFactory<NativeMediaFileUtil> weak_factory_; 194 base::WeakPtrFactory<NativeMediaFileUtil> weak_factory_;
195 195
196 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); 196 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil);
197 }; 197 };
198 198
199 } // namespace chrome 199 } // namespace chrome
200 200
201 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_ 201 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698