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

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

Issue 16413007: Make FileSystemOperation NOT self-destruct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser_tests Created 7 years, 6 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 bool CreateOrOpen(
29 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 bool EnsureFileExists(
34 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 bool CreateDirectory(
38 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 bool GetFileInfo(
44 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 bool ReadDirectory(
48 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 bool Touch(
52 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 bool Truncate(
58 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 bool CopyFileLocal(
63 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 bool MoveFileLocal(
68 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 bool CopyInForeignFile(
73 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 bool DeleteFile(
78 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 bool DeleteDirectory(
82 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 CreateSnapshotFile( 85 virtual bool CreateSnapshotFile(
86 fileapi::FileSystemOperationContext* context, 86 scoped_ptr<fileapi::FileSystemOperationContext> context,
87 const fileapi::FileSystemURL& url, 87 const fileapi::FileSystemURL& url,
88 const CreateSnapshotFileCallback& callback) OVERRIDE; 88 const CreateSnapshotFileCallback& callback) OVERRIDE;
89 89
90 protected: 90 protected:
91 virtual void CreateDirectoryOnTaskRunnerThread( 91 virtual void CreateDirectoryOnTaskRunnerThread(
92 fileapi::FileSystemOperationContext* context, 92 fileapi::FileSystemOperationContext* context,
93 const fileapi::FileSystemURL& url, 93 const fileapi::FileSystemURL& url,
94 bool exclusive, 94 bool exclusive,
95 bool recursive, 95 bool recursive,
96 const StatusCallback& callback); 96 const StatusCallback& callback);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 189
190 base::WeakPtrFactory<NativeMediaFileUtil> weak_factory_; 190 base::WeakPtrFactory<NativeMediaFileUtil> weak_factory_;
191 191
192 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); 192 DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil);
193 }; 193 };
194 194
195 } // namespace chrome 195 } // namespace chrome
196 196
197 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_ 197 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_NATIVE_MEDIA_FILE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698