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

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

Issue 416223003: Unify HasGDocFileExtension and IsHostedDocumentByExtentoin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/fileapi/file_system_backend_delegate.h" 5 #include "chrome/browser/chromeos/drive/fileapi/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/file_system_util.h" 10 #include "chrome/browser/chromeos/drive/file_system_util.h"
11 #include "chrome/browser/chromeos/drive/fileapi/async_file_util.h" 11 #include "chrome/browser/chromeos/drive/fileapi/async_file_util.h"
12 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h" 12 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h"
13 #include "chrome/browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl.h " 13 #include "chrome/browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl.h "
14 #include "chrome/browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.h " 14 #include "chrome/browser/chromeos/drive/fileapi/webkit_file_stream_writer_impl.h "
15 #include "chrome/browser/drive/drive_api_util.h"
15 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
16 #include "webkit/browser/blob/file_stream_reader.h" 17 #include "webkit/browser/blob/file_stream_reader.h"
17 #include "webkit/browser/fileapi/async_file_util.h" 18 #include "webkit/browser/fileapi/async_file_util.h"
18 #include "webkit/browser/fileapi/file_system_context.h" 19 #include "webkit/browser/fileapi/file_system_context.h"
19 #include "webkit/browser/fileapi/file_system_url.h" 20 #include "webkit/browser/fileapi/file_system_url.h"
20 21
21 using content::BrowserThread; 22 using content::BrowserThread;
22 23
23 namespace drive { 24 namespace drive {
24 25
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 scoped_ptr<fileapi::FileStreamWriter> 60 scoped_ptr<fileapi::FileStreamWriter>
60 FileSystemBackendDelegate::CreateFileStreamWriter( 61 FileSystemBackendDelegate::CreateFileStreamWriter(
61 const fileapi::FileSystemURL& url, 62 const fileapi::FileSystemURL& url,
62 int64 offset, 63 int64 offset,
63 fileapi::FileSystemContext* context) { 64 fileapi::FileSystemContext* context) {
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
65 DCHECK_EQ(fileapi::kFileSystemTypeDrive, url.type()); 66 DCHECK_EQ(fileapi::kFileSystemTypeDrive, url.type());
66 67
67 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 68 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
68 // Hosted documents don't support stream writer. 69 // Hosted documents don't support stream writer.
69 if (file_path.empty() || util::HasGDocFileExtension(file_path)) 70 if (file_path.empty() || util::HasHostedDocumentExtension(file_path))
70 return scoped_ptr<fileapi::FileStreamWriter>(); 71 return scoped_ptr<fileapi::FileStreamWriter>();
71 72
72 return scoped_ptr<fileapi::FileStreamWriter>( 73 return scoped_ptr<fileapi::FileStreamWriter>(
73 new internal::WebkitFileStreamWriterImpl( 74 new internal::WebkitFileStreamWriterImpl(
74 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 75 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
75 context->default_file_task_runner(),file_path, offset)); 76 context->default_file_task_runner(),file_path, offset));
76 } 77 }
77 78
78 } // namespace drive 79 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util_unittest.cc ('k') | chrome/browser/chromeos/file_manager/file_tasks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698