| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_system_dir_url_request_job.h" | 5 #include "webkit/fileapi/file_system_dir_url_request_job.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/file_util_proxy.h" | 11 #include "base/file_util_proxy.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
| 22 #include "net/url_request/url_request.h" | 22 #include "net/url_request/url_request.h" |
| 23 #include "net/url_request/url_request_context.h" |
| 23 #include "webkit/fileapi/file_system_context.h" | 24 #include "webkit/fileapi/file_system_context.h" |
| 24 #include "webkit/fileapi/file_system_operation.h" | 25 #include "webkit/fileapi/file_system_operation.h" |
| 25 #include "webkit/fileapi/file_system_util.h" | 26 #include "webkit/fileapi/file_system_util.h" |
| 26 | 27 |
| 27 using net::URLRequest; | 28 using net::URLRequest; |
| 28 using net::URLRequestJob; | 29 using net::URLRequestJob; |
| 29 using net::URLRequestStatus; | 30 using net::URLRequestStatus; |
| 30 | 31 |
| 31 namespace fileapi { | 32 namespace fileapi { |
| 32 | 33 |
| 33 static FilePath GetRelativePath(const GURL& url) { | 34 static FilePath GetRelativePath(const GURL& url) { |
| 34 FilePath relative_path; | 35 FilePath relative_path; |
| 35 GURL unused_url; | 36 GURL unused_url; |
| 36 FileSystemType unused_type; | 37 FileSystemType unused_type; |
| 37 CrackFileSystemURL(url, &unused_url, &unused_type, &relative_path); | 38 CrackFileSystemURL(url, &unused_url, &unused_type, &relative_path); |
| 38 return relative_path; | 39 return relative_path; |
| 39 } | 40 } |
| 40 | 41 |
| 41 FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( | 42 FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( |
| 42 URLRequest* request, FileSystemContext* file_system_context) | 43 URLRequest* request, FileSystemContext* file_system_context) |
| 43 : URLRequestJob(request), | 44 : URLRequestJob(request, request->context()->network_delegate()), |
| 44 file_system_context_(file_system_context), | 45 file_system_context_(file_system_context), |
| 45 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 46 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 46 } | 47 } |
| 47 | 48 |
| 48 FileSystemDirURLRequestJob::~FileSystemDirURLRequestJob() { | 49 FileSystemDirURLRequestJob::~FileSystemDirURLRequestJob() { |
| 49 } | 50 } |
| 50 | 51 |
| 51 bool FileSystemDirURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size, | 52 bool FileSystemDirURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size, |
| 52 int *bytes_read) { | 53 int *bytes_read) { |
| 53 int count = std::min(dest_size, static_cast<int>(data_.size())); | 54 int count = std::min(dest_size, static_cast<int>(data_.size())); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 NotifyHeadersComplete(); | 137 NotifyHeadersComplete(); |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 | 140 |
| 140 FileSystemOperationInterface* | 141 FileSystemOperationInterface* |
| 141 FileSystemDirURLRequestJob::GetNewOperation(const GURL& url) { | 142 FileSystemDirURLRequestJob::GetNewOperation(const GURL& url) { |
| 142 return file_system_context_->CreateFileSystemOperation(url); | 143 return file_system_context_->CreateFileSystemOperation(url); |
| 143 } | 144 } |
| 144 | 145 |
| 145 } // namespace fileapi | 146 } // namespace fileapi |
| OLD | NEW |