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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_backend_delegate.cc

Issue 20989003: Deprecate FileSystemTaskRunners (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/chromeos/drive/file_system_backend_delegate.h" 5 #include "chrome/browser/chromeos/drive/file_system_backend_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/chromeos/drive/async_file_util.h" 10 #include "chrome/browser/chromeos/drive/async_file_util.h"
11 #include "chrome/browser/chromeos/drive/file_system_util.h" 11 #include "chrome/browser/chromeos/drive/file_system_util.h"
12 #include "chrome/browser/chromeos/drive/webkit_file_stream_reader_impl.h" 12 #include "chrome/browser/chromeos/drive/webkit_file_stream_reader_impl.h"
13 #include "chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.h" 13 #include "chrome/browser/chromeos/drive/webkit_file_stream_writer_impl.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "webkit/browser/blob/file_stream_reader.h" 17 #include "webkit/browser/blob/file_stream_reader.h"
18 #include "webkit/browser/fileapi/async_file_util.h" 18 #include "webkit/browser/fileapi/async_file_util.h"
19 #include "webkit/browser/fileapi/file_system_context.h" 19 #include "webkit/browser/fileapi/file_system_context.h"
20 #include "webkit/browser/fileapi/file_system_task_runners.h"
21 #include "webkit/browser/fileapi/file_system_url.h" 20 #include "webkit/browser/fileapi/file_system_url.h"
22 21
23 using content::BrowserThread; 22 using content::BrowserThread;
24 23
25 namespace drive { 24 namespace drive {
26 25
27 FileSystemBackendDelegate::FileSystemBackendDelegate( 26 FileSystemBackendDelegate::FileSystemBackendDelegate(
28 content::BrowserContext* browser_context) 27 content::BrowserContext* browser_context)
29 : profile_id_(Profile::FromBrowserContext(browser_context)), 28 : profile_id_(Profile::FromBrowserContext(browser_context)),
30 async_file_util_(new internal::AsyncFileUtil( 29 async_file_util_(new internal::AsyncFileUtil(
(...skipping 20 matching lines...) Expand all
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
52 DCHECK_EQ(fileapi::kFileSystemTypeDrive, url.type()); 51 DCHECK_EQ(fileapi::kFileSystemTypeDrive, url.type());
53 52
54 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 53 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
55 if (file_path.empty()) 54 if (file_path.empty())
56 return scoped_ptr<webkit_blob::FileStreamReader>(); 55 return scoped_ptr<webkit_blob::FileStreamReader>();
57 56
58 return scoped_ptr<webkit_blob::FileStreamReader>( 57 return scoped_ptr<webkit_blob::FileStreamReader>(
59 new internal::WebkitFileStreamReaderImpl( 58 new internal::WebkitFileStreamReaderImpl(
60 base::Bind(&util::GetFileSystemByProfileId, profile_id_), 59 base::Bind(&util::GetFileSystemByProfileId, profile_id_),
61 context->task_runners()->file_task_runner(), 60 context->default_file_task_runner(),
62 file_path, offset, expected_modification_time)); 61 file_path, offset, expected_modification_time));
63 } 62 }
64 63
65 scoped_ptr<fileapi::FileStreamWriter> 64 scoped_ptr<fileapi::FileStreamWriter>
66 FileSystemBackendDelegate::CreateFileStreamWriter( 65 FileSystemBackendDelegate::CreateFileStreamWriter(
67 const fileapi::FileSystemURL& url, 66 const fileapi::FileSystemURL& url,
68 int64 offset, 67 int64 offset,
69 fileapi::FileSystemContext* context) { 68 fileapi::FileSystemContext* context) {
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
71 DCHECK_EQ(fileapi::kFileSystemTypeDrive, url.type()); 70 DCHECK_EQ(fileapi::kFileSystemTypeDrive, url.type());
72 71
73 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 72 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
74 if (file_path.empty()) 73 if (file_path.empty())
75 return scoped_ptr<fileapi::FileStreamWriter>(); 74 return scoped_ptr<fileapi::FileStreamWriter>();
76 75
77 return scoped_ptr<fileapi::FileStreamWriter>( 76 return scoped_ptr<fileapi::FileStreamWriter>(
78 new internal::WebkitFileStreamWriterImpl( 77 new internal::WebkitFileStreamWriterImpl(
79 base::Bind(&util::GetFileSystemByProfileId, profile_id_), 78 base::Bind(&util::GetFileSystemByProfileId, profile_id_),
80 context->task_runners()->file_task_runner(),file_path, offset)); 79 context->default_file_task_runner(),file_path, offset));
81 } 80 }
82 81
83 } // namespace drive 82 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698