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

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

Issue 2827853003: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/media_galleries (Closed)
Patch Set: Created 3 years, 8 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) 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 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" 5 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 void OnPreferencesInit( 69 void OnPreferencesInit(
70 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, 70 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
71 const extensions::Extension* extension, 71 const extensions::Extension* extension,
72 MediaGalleryPrefId pref_id, 72 MediaGalleryPrefId pref_id,
73 const base::Callback<void(base::File::Error result)>& callback) { 73 const base::Callback<void(base::File::Error result)>& callback) {
74 content::WebContents* contents = web_contents_getter.Run(); 74 content::WebContents* contents = web_contents_getter.Run();
75 if (!contents) { 75 if (!contents) {
76 content::BrowserThread::PostTask( 76 content::BrowserThread::PostTask(
77 content::BrowserThread::IO, FROM_HERE, 77 content::BrowserThread::IO, FROM_HERE,
78 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 78 base::BindOnce(callback, base::File::FILE_ERROR_FAILED));
79 return; 79 return;
80 } 80 }
81 MediaFileSystemRegistry* registry = 81 MediaFileSystemRegistry* registry =
82 g_browser_process->media_file_system_registry(); 82 g_browser_process->media_file_system_registry();
83 registry->RegisterMediaFileSystemForExtension(contents, extension, pref_id, 83 registry->RegisterMediaFileSystemForExtension(contents, extension, pref_id,
84 callback); 84 callback);
85 } 85 }
86 86
87 void AttemptAutoMountOnUIThread( 87 void AttemptAutoMountOnUIThread(
88 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, 88 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
(...skipping 27 matching lines...) Expand all
116 // Pass the WebContentsGetter to the closure to prevent a use-after-free 116 // Pass the WebContentsGetter to the closure to prevent a use-after-free
117 // in the case that the web_contents is destroyed before the closure runs. 117 // in the case that the web_contents is destroyed before the closure runs.
118 preferences->EnsureInitialized(base::Bind(&OnPreferencesInit, 118 preferences->EnsureInitialized(base::Bind(&OnPreferencesInit,
119 web_contents_getter, extension, 119 web_contents_getter, extension,
120 pref_id, callback)); 120 pref_id, callback));
121 return; 121 return;
122 } 122 }
123 } 123 }
124 124
125 content::BrowserThread::PostTask( 125 content::BrowserThread::PostTask(
126 content::BrowserThread::IO, 126 content::BrowserThread::IO, FROM_HERE,
127 FROM_HERE, 127 base::BindOnce(callback, base::File::FILE_ERROR_NOT_FOUND));
128 base::Bind(callback, base::File::FILE_ERROR_NOT_FOUND));
129 } 128 }
130 129
131 } // namespace 130 } // namespace
132 131
133 const char MediaFileSystemBackend::kMediaTaskRunnerName[] = 132 const char MediaFileSystemBackend::kMediaTaskRunnerName[] =
134 "media-task-runner"; 133 "media-task-runner";
135 134
136 MediaFileSystemBackend::MediaFileSystemBackend( 135 MediaFileSystemBackend::MediaFileSystemBackend(
137 const base::FilePath& profile_path, 136 const base::FilePath& profile_path,
138 base::SequencedTaskRunner* media_task_runner) 137 base::SequencedTaskRunner* media_task_runner)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 base::CompareCase::SENSITIVE)) 215 base::CompareCase::SENSITIVE))
217 return false; 216 return false;
218 217
219 const content::ResourceRequestInfo* request_info = 218 const content::ResourceRequestInfo* request_info =
220 content::ResourceRequestInfo::ForRequest(url_request); 219 content::ResourceRequestInfo::ForRequest(url_request);
221 if (!request_info) 220 if (!request_info)
222 return false; 221 return false;
223 222
224 content::BrowserThread::PostTask( 223 content::BrowserThread::PostTask(
225 content::BrowserThread::UI, FROM_HERE, 224 content::BrowserThread::UI, FROM_HERE,
226 base::Bind(&AttemptAutoMountOnUIThread, 225 base::BindOnce(&AttemptAutoMountOnUIThread,
227 request_info->GetWebContentsGetterForRequest(), storage_domain, 226 request_info->GetWebContentsGetterForRequest(),
228 mount_point, callback)); 227 storage_domain, mount_point, callback));
229 return true; 228 return true;
230 } 229 }
231 230
232 bool MediaFileSystemBackend::CanHandleType(storage::FileSystemType type) const { 231 bool MediaFileSystemBackend::CanHandleType(storage::FileSystemType type) const {
233 switch (type) { 232 switch (type) {
234 case storage::kFileSystemTypeNativeMedia: 233 case storage::kFileSystemTypeNativeMedia:
235 case storage::kFileSystemTypeDeviceMedia: 234 case storage::kFileSystemTypeDeviceMedia:
236 #if defined(OS_WIN) || defined(OS_MACOSX) 235 #if defined(OS_WIN) || defined(OS_MACOSX)
237 case storage::kFileSystemTypePicasa: 236 case storage::kFileSystemTypePicasa:
238 case storage::kFileSystemTypeItunes: 237 case storage::kFileSystemTypeItunes:
239 #endif // defined(OS_WIN) || defined(OS_MACOSX) 238 #endif // defined(OS_WIN) || defined(OS_MACOSX)
240 return true; 239 return true;
241 default: 240 default:
242 return false; 241 return false;
243 } 242 }
244 } 243 }
245 244
246 void MediaFileSystemBackend::Initialize(storage::FileSystemContext* context) { 245 void MediaFileSystemBackend::Initialize(storage::FileSystemContext* context) {
247 } 246 }
248 247
249 void MediaFileSystemBackend::ResolveURL( 248 void MediaFileSystemBackend::ResolveURL(
250 const FileSystemURL& url, 249 const FileSystemURL& url,
251 storage::OpenFileSystemMode mode, 250 storage::OpenFileSystemMode mode,
252 const OpenFileSystemCallback& callback) { 251 const OpenFileSystemCallback& callback) {
253 // We never allow opening a new FileSystem via usual ResolveURL. 252 // We never allow opening a new FileSystem via usual ResolveURL.
254 base::ThreadTaskRunnerHandle::Get()->PostTask( 253 base::ThreadTaskRunnerHandle::Get()->PostTask(
255 FROM_HERE, 254 FROM_HERE, base::BindOnce(callback, GURL(), std::string(),
256 base::Bind(callback, 255 base::File::FILE_ERROR_SECURITY));
257 GURL(),
258 std::string(),
259 base::File::FILE_ERROR_SECURITY));
260 } 256 }
261 257
262 storage::AsyncFileUtil* MediaFileSystemBackend::GetAsyncFileUtil( 258 storage::AsyncFileUtil* MediaFileSystemBackend::GetAsyncFileUtil(
263 storage::FileSystemType type) { 259 storage::FileSystemType type) {
264 // We count file system usages here, because we want to count (per session) 260 // We count file system usages here, because we want to count (per session)
265 // when the file system is actually used for I/O, rather than merely present. 261 // when the file system is actually used for I/O, rather than merely present.
266 switch (type) { 262 switch (type) {
267 case storage::kFileSystemTypeNativeMedia: 263 case storage::kFileSystemTypeNativeMedia:
268 return native_media_file_util_.get(); 264 return native_media_file_util_.get();
269 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) 265 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 388
393 const storage::ChangeObserverList* MediaFileSystemBackend::GetChangeObservers( 389 const storage::ChangeObserverList* MediaFileSystemBackend::GetChangeObservers(
394 storage::FileSystemType type) const { 390 storage::FileSystemType type) const {
395 return NULL; 391 return NULL;
396 } 392 }
397 393
398 const storage::AccessObserverList* MediaFileSystemBackend::GetAccessObservers( 394 const storage::AccessObserverList* MediaFileSystemBackend::GetAccessObservers(
399 storage::FileSystemType type) const { 395 storage::FileSystemType type) const {
400 return NULL; 396 return NULL;
401 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698