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

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

Issue 293033009: Media Galleries: Make DeviceMediaAsyncFileUtil filter directory contents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_ 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_ 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H_
7 7
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
12 #include "webkit/browser/fileapi/async_file_util.h" 13 #include "webkit/browser/fileapi/async_file_util.h"
13 #include "webkit/common/blob/shareable_file_reference.h" 14 #include "webkit/common/blob/shareable_file_reference.h"
14 15
15 namespace fileapi { 16 namespace fileapi {
16 class FileSystemOperationContext; 17 class FileSystemOperationContext;
17 class FileSystemURL; 18 class FileSystemURL;
18 } 19 }
19 20
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // underlying storage. The returned FileStreamReader must return an error 113 // underlying storage. The returned FileStreamReader must return an error
113 // when the state of the underlying storage changes. Any errors associated 114 // when the state of the underlying storage changes. Any errors associated
114 // with reading this file are returned by the FileStreamReader itself. 115 // with reading this file are returned by the FileStreamReader itself.
115 virtual scoped_ptr<webkit_blob::FileStreamReader> GetFileStreamReader( 116 virtual scoped_ptr<webkit_blob::FileStreamReader> GetFileStreamReader(
116 const fileapi::FileSystemURL& url, 117 const fileapi::FileSystemURL& url,
117 int64 offset, 118 int64 offset,
118 const base::Time& expected_modification_time, 119 const base::Time& expected_modification_time,
119 fileapi::FileSystemContext* context); 120 fileapi::FileSystemContext* context);
120 121
121 private: 122 private:
123 class MediaPathFilterWrapper;
124
122 // Use Create() to get an instance of DeviceMediaAsyncFileUtil. 125 // Use Create() to get an instance of DeviceMediaAsyncFileUtil.
123 DeviceMediaAsyncFileUtil(const base::FilePath& profile_path, 126 DeviceMediaAsyncFileUtil(const base::FilePath& profile_path,
124 MediaFileValidationType validation_type); 127 MediaFileValidationType validation_type);
125 128
126 // Called when GetFileInfo method call succeeds. |file_info| contains the 129 // Called when GetFileInfo method call succeeds. |file_info| contains the
127 // file details of the requested url. |callback| is invoked to complete the 130 // file details of the requested url. |callback| is invoked to complete the
128 // GetFileInfo request. 131 // GetFileInfo request.
129 void OnDidGetFileInfo(const GetFileInfoCallback& callback, 132 void OnDidGetFileInfo(
130 const base::File::Info& file_info); 133 scoped_ptr<fileapi::FileSystemOperationContext> context,
134 const base::FilePath& path,
135 const GetFileInfoCallback& callback,
136 const base::File::Info& file_info);
131 137
132 // Called when ReadDirectory method call succeeds. |callback| is invoked to 138 // Called when ReadDirectory method call succeeds. |callback| is invoked to
133 // complete the ReadDirectory request. 139 // complete the ReadDirectory request.
134 // 140 //
135 // If the contents of the given directory are reported in one batch, then 141 // If the contents of the given directory are reported in one batch, then
136 // |file_list| will have the list of all files/directories in the given 142 // |file_list| will have the list of all files/directories in the given
137 // directory and |has_more| will be false. 143 // directory and |has_more| will be false.
138 // 144 //
139 // If the contents of the given directory are reported in multiple chunks, 145 // If the contents of the given directory are reported in multiple chunks,
140 // |file_list| will have only a subset of all contents (the subsets reported 146 // |file_list| will have only a subset of all contents (the subsets reported
141 // in any two calls are disjoint), and |has_more| will be true, except for 147 // in any two calls are disjoint), and |has_more| will be true, except for
142 // the last chunk. 148 // the last chunk.
143 void OnDidReadDirectory( 149 void OnDidReadDirectory(
150 scoped_ptr<fileapi::FileSystemOperationContext> context,
144 const ReadDirectoryCallback& callback, 151 const ReadDirectoryCallback& callback,
145 const EntryList& file_list, 152 const EntryList& file_list,
146 bool has_more); 153 bool has_more);
147 154
148 bool validate_media_files() const; 155 bool validate_media_files() const;
149 156
150 // Profile path. 157 // Profile path.
151 const base::FilePath profile_path_; 158 const base::FilePath profile_path_;
152 159
153 const MediaFileValidationType validation_type_; 160 scoped_refptr<MediaPathFilterWrapper> media_path_filter_wrapper_;
154 161
155 // For callbacks that may run after destruction. 162 // For callbacks that may run after destruction.
156 base::WeakPtrFactory<DeviceMediaAsyncFileUtil> weak_ptr_factory_; 163 base::WeakPtrFactory<DeviceMediaAsyncFileUtil> weak_ptr_factory_;
157 164
158 DISALLOW_COPY_AND_ASSIGN(DeviceMediaAsyncFileUtil); 165 DISALLOW_COPY_AND_ASSIGN(DeviceMediaAsyncFileUtil);
159 }; 166 };
160 167
161 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H _ 168 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_DEVICE_MEDIA_ASYNC_FILE_UTIL_H _
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698