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

Side by Side Diff: webkit/fileapi/async_file_util_adapter.cc

Issue 12703012: Have media gallery (through native media file util) use MIME sniffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Previous code review response, plus trying to get new unit test passing. Created 7 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 | Annotate | Revision Log
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 "webkit/fileapi/async_file_util_adapter.h" 5 #include "webkit/fileapi/async_file_util_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "webkit/fileapi/file_system_context.h" 10 #include "webkit/fileapi/file_system_context.h"
11 #include "webkit/fileapi/file_system_file_util.h" 11 #include "webkit/fileapi/file_system_file_util.h"
12 #include "webkit/fileapi/file_system_operation_context.h" 12 #include "webkit/fileapi/file_system_operation_context.h"
13 #include "webkit/fileapi/file_system_url.h" 13 #include "webkit/fileapi/file_system_url.h"
14 #include "webkit/fileapi/file_system_util.h" 14 #include "webkit/fileapi/file_system_util.h"
15 #include <fstream>
15 16
16 namespace fileapi { 17 namespace fileapi {
17 18
18 using base::Bind; 19 using base::Bind;
19 using base::Callback; 20 using base::Callback;
20 using base::Owned; 21 using base::Owned;
21 using base::PlatformFileError; 22 using base::PlatformFileError;
22 using base::Unretained; 23 using base::Unretained;
23 24
24 namespace { 25 namespace {
(...skipping 27 matching lines...) Expand all
52 53
53 void GetFileInfo(FileSystemFileUtil* file_util, 54 void GetFileInfo(FileSystemFileUtil* file_util,
54 FileSystemOperationContext* context, 55 FileSystemOperationContext* context,
55 const FileSystemURL& url) { 56 const FileSystemURL& url) {
56 error_ = file_util->GetFileInfo(context, url, &file_info_, &platform_path_); 57 error_ = file_util->GetFileInfo(context, url, &file_info_, &platform_path_);
57 } 58 }
58 59
59 void CreateSnapshotFile(FileSystemFileUtil* file_util, 60 void CreateSnapshotFile(FileSystemFileUtil* file_util,
60 FileSystemOperationContext* context, 61 FileSystemOperationContext* context,
61 const FileSystemURL& url) { 62 const FileSystemURL& url) {
63 LOG(WARNING) << "GetFileInfoHelper::CreateSnapshotFile";
64 std::ofstream mylog("/tmp/krblog", std::ios::app);
65 mylog << "GetFileInfoHelper::CreateSnapshotFile" << std::endl;
62 error_ = file_util->CreateSnapshotFile( 66 error_ = file_util->CreateSnapshotFile(
63 context, url, &file_info_, &platform_path_, &snapshot_policy_); 67 context, url, &file_info_, &platform_path_, &snapshot_policy_);
64 } 68 }
65 69
66 void ReplyFileInfo(const AsyncFileUtil::GetFileInfoCallback& callback) { 70 void ReplyFileInfo(const AsyncFileUtil::GetFileInfoCallback& callback) {
67 if (!callback.is_null()) 71 if (!callback.is_null())
68 callback.Run(error_, file_info_, platform_path_); 72 callback.Run(error_, file_info_, platform_path_);
69 } 73 }
70 74
71 void ReplySnapshotFile( 75 void ReplySnapshotFile(
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 Unretained(sync_file_util_.get()), 293 Unretained(sync_file_util_.get()),
290 context, url), 294 context, url),
291 callback); 295 callback);
292 } 296 }
293 297
294 bool AsyncFileUtilAdapter::CreateSnapshotFile( 298 bool AsyncFileUtilAdapter::CreateSnapshotFile(
295 FileSystemOperationContext* context, 299 FileSystemOperationContext* context,
296 const FileSystemURL& url, 300 const FileSystemURL& url,
297 const CreateSnapshotFileCallback& callback) { 301 const CreateSnapshotFileCallback& callback) {
298 GetFileInfoHelper* helper = new GetFileInfoHelper; 302 GetFileInfoHelper* helper = new GetFileInfoHelper;
303 #if 1
299 return context->task_runner()->PostTaskAndReply( 304 return context->task_runner()->PostTaskAndReply(
300 FROM_HERE, 305 FROM_HERE,
301 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper), 306 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper),
302 sync_file_util_.get(), context, url), 307 sync_file_util_.get(), context, url),
303 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback)); 308 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback));
309 #else
310 helper->CreateSnapshotFile(sync_file_util_.get(), context, url);
311 helper->ReplySnapshotFile(callback);
312 return true;
313 #endif
304 } 314 }
305 315
306 } // namespace fileapi 316 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/local_file_util.cc » ('j') | webkit/fileapi/media/native_media_file_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698