| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/file_system/file_system_dispatcher_host.h" | 5 #include "content/browser/file_system/file_system_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 dispatcher_host_->Send(new FileSystemMsg_DidFail(request_id_, error_code)); | 68 dispatcher_host_->Send(new FileSystemMsg_DidFail(request_id_, error_code)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual void DidWrite(int64 bytes, bool complete) { | 71 virtual void DidWrite(int64 bytes, bool complete) { |
| 72 dispatcher_host_->Send(new FileSystemMsg_DidWrite( | 72 dispatcher_host_->Send(new FileSystemMsg_DidWrite( |
| 73 request_id_, bytes, complete)); | 73 request_id_, bytes, complete)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual void DidOpenFile( | 76 virtual void DidOpenFile( |
| 77 base::PlatformFile file, | 77 base::PlatformFile file, |
| 78 base::ProcessHandle peer_handle) { | 78 base::ProcessHandle peer_handle, |
| 79 int64 file_size) { |
| 79 IPC::PlatformFileForTransit file_for_transit = | 80 IPC::PlatformFileForTransit file_for_transit = |
| 80 file != base::kInvalidPlatformFileValue ? | 81 file != base::kInvalidPlatformFileValue ? |
| 81 IPC::GetFileHandleForProcess(file, peer_handle, true) : | 82 IPC::GetFileHandleForProcess(file, peer_handle, true) : |
| 82 IPC::InvalidPlatformFileForTransit(); | 83 IPC::InvalidPlatformFileForTransit(); |
| 83 | 84 |
| 84 dispatcher_host_->Send(new FileSystemMsg_DidOpenFile( | 85 dispatcher_host_->Send(new FileSystemMsg_DidOpenFile( |
| 85 request_id_, file_for_transit)); | 86 request_id_, file_for_transit, file_size)); |
| 86 } | 87 } |
| 87 | 88 |
| 88 private: | 89 private: |
| 89 scoped_refptr<FileSystemDispatcherHost> dispatcher_host_; | 90 scoped_refptr<FileSystemDispatcherHost> dispatcher_host_; |
| 90 int request_id_; | 91 int request_id_; |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 FileSystemDispatcherHost::FileSystemDispatcherHost( | 94 FileSystemDispatcherHost::FileSystemDispatcherHost( |
| 94 const content::ResourceContext* resource_context) | 95 const content::ResourceContext* resource_context) |
| 95 : context_(NULL), | 96 : context_(NULL), |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 context_, | 253 context_, |
| 253 NULL); | 254 NULL); |
| 254 operations_.AddWithID(operation, request_id); | 255 operations_.AddWithID(operation, request_id); |
| 255 return operation; | 256 return operation; |
| 256 } | 257 } |
| 257 | 258 |
| 258 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { | 259 void FileSystemDispatcherHost::UnregisterOperation(int request_id) { |
| 259 DCHECK(operations_.Lookup(request_id)); | 260 DCHECK(operations_.Lookup(request_id)); |
| 260 operations_.Remove(request_id); | 261 operations_.Remove(request_id); |
| 261 } | 262 } |
| OLD | NEW |