| 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/tools/test_shell/simple_file_writer.h" | 5 #include "webkit/tools/test_shell/simple_file_writer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 operation_->Cancel(base::Bind(&IOThreadProxy::DidFinish, this)); | 88 operation_->Cancel(base::Bind(&IOThreadProxy::DidFinish, this)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 friend class base::RefCountedThreadSafe<IOThreadProxy>; | 92 friend class base::RefCountedThreadSafe<IOThreadProxy>; |
| 93 virtual ~IOThreadProxy() {} | 93 virtual ~IOThreadProxy() {} |
| 94 | 94 |
| 95 FileSystemOperation* GetNewOperation( const FileSystemURL& url) { | 95 FileSystemOperation* GetNewOperation( const FileSystemURL& url) { |
| 96 return file_system_context_->CreateFileSystemOperation(url); | 96 return file_system_context_->CreateFileSystemOperation(url, NULL); |
| 97 } | 97 } |
| 98 | 98 |
| 99 // Returns true if it is not writable. | 99 // Returns true if it is not writable. |
| 100 bool FailIfNotWritable(const FileSystemURL& url) { | 100 bool FailIfNotWritable(const FileSystemURL& url) { |
| 101 if (url.type() == fileapi::kFileSystemTypeDragged) { | 101 if (url.type() == fileapi::kFileSystemTypeDragged) { |
| 102 // Write is not allowed in isolate file system in SimpleFileWriter. | 102 // Write is not allowed in isolate file system in SimpleFileWriter. |
| 103 DidFailOnMainThread(base::PLATFORM_FILE_ERROR_SECURITY); | 103 DidFailOnMainThread(base::PLATFORM_FILE_ERROR_SECURITY); |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 return false; | 106 return false; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 void SimpleFileWriter::DoWrite( | 196 void SimpleFileWriter::DoWrite( |
| 197 const GURL& path, const GURL& blob_url, int64 offset) { | 197 const GURL& path, const GURL& blob_url, int64 offset) { |
| 198 FileSystemURL url(path); | 198 FileSystemURL url(path); |
| 199 io_thread_proxy_->Write(url, blob_url, offset); | 199 io_thread_proxy_->Write(url, blob_url, offset); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void SimpleFileWriter::DoCancel() { | 202 void SimpleFileWriter::DoCancel() { |
| 203 io_thread_proxy_->Cancel(); | 203 io_thread_proxy_->Cancel(); |
| 204 } | 204 } |
| OLD | NEW |