| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 static FilePath GetRelativePath(const GURL& url) { | 33 static FilePath GetRelativePath(const GURL& url) { |
| 34 FilePath relative_path; | 34 FilePath relative_path; |
| 35 GURL unused_url; | 35 GURL unused_url; |
| 36 FileSystemType unused_type; | 36 FileSystemType unused_type; |
| 37 CrackFileSystemURL(url, &unused_url, &unused_type, &relative_path); | 37 CrackFileSystemURL(url, &unused_url, &unused_type, &relative_path); |
| 38 return relative_path; | 38 return relative_path; |
| 39 } | 39 } |
| 40 | 40 |
| 41 FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( | 41 FileSystemDirURLRequestJob::FileSystemDirURLRequestJob( |
| 42 URLRequest* request, FileSystemContext* file_system_context, | 42 URLRequest* request, FileSystemContext* file_system_context) |
| 43 scoped_refptr<base::MessageLoopProxy> file_thread_proxy) | |
| 44 : URLRequestJob(request), | 43 : URLRequestJob(request), |
| 45 file_system_context_(file_system_context), | 44 file_system_context_(file_system_context), |
| 46 file_thread_proxy_(file_thread_proxy), | |
| 47 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 45 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 48 } | 46 } |
| 49 | 47 |
| 50 FileSystemDirURLRequestJob::~FileSystemDirURLRequestJob() { | 48 FileSystemDirURLRequestJob::~FileSystemDirURLRequestJob() { |
| 51 } | 49 } |
| 52 | 50 |
| 53 bool FileSystemDirURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size, | 51 bool FileSystemDirURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size, |
| 54 int *bytes_read) { | 52 int *bytes_read) { |
| 55 int count = std::min(dest_size, static_cast<int>(data_.size())); | 53 int count = std::min(dest_size, static_cast<int>(data_.size())); |
| 56 if (count > 0) { | 54 if (count > 0) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 request_->url(), | 132 request_->url(), |
| 135 base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this)); | 133 base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this)); |
| 136 } else { | 134 } else { |
| 137 set_expected_content_size(data_.size()); | 135 set_expected_content_size(data_.size()); |
| 138 NotifyHeadersComplete(); | 136 NotifyHeadersComplete(); |
| 139 } | 137 } |
| 140 } | 138 } |
| 141 | 139 |
| 142 FileSystemOperationInterface* | 140 FileSystemOperationInterface* |
| 143 FileSystemDirURLRequestJob::GetNewOperation(const GURL& url) { | 141 FileSystemDirURLRequestJob::GetNewOperation(const GURL& url) { |
| 144 return file_system_context_->CreateFileSystemOperation( | 142 return file_system_context_->CreateFileSystemOperation(url); |
| 145 url, | |
| 146 file_thread_proxy_); | |
| 147 } | 143 } |
| 148 | 144 |
| 149 } // namespace fileapi | 145 } // namespace fileapi |
| OLD | NEW |