| 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 "device/media_transfer_protocol/media_transfer_protocol_daemon_client.h
" | 5 #include "device/media_transfer_protocol/media_transfer_protocol_daemon_client.h
" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 base::Bind(&MediaTransferProtocolDaemonClientImpl::OnRenameObject, | 217 base::Bind(&MediaTransferProtocolDaemonClientImpl::OnRenameObject, |
| 218 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); | 218 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void CopyFileFromLocal(const std::string& handle, | 221 void CopyFileFromLocal(const std::string& handle, |
| 222 const int source_file_descriptor, | 222 const int source_file_descriptor, |
| 223 const uint32_t parent_id, | 223 const uint32_t parent_id, |
| 224 const std::string& file_name, | 224 const std::string& file_name, |
| 225 const CopyFileFromLocalCallback& callback, | 225 const CopyFileFromLocalCallback& callback, |
| 226 const ErrorCallback& error_callback) override { | 226 const ErrorCallback& error_callback) override { |
| 227 dbus::FileDescriptor file_descriptor(source_file_descriptor); | |
| 228 file_descriptor.CheckValidity(); | |
| 229 | |
| 230 dbus::MethodCall method_call(mtpd::kMtpdInterface, | 227 dbus::MethodCall method_call(mtpd::kMtpdInterface, |
| 231 mtpd::kCopyFileFromLocal); | 228 mtpd::kCopyFileFromLocal); |
| 232 dbus::MessageWriter writer(&method_call); | 229 dbus::MessageWriter writer(&method_call); |
| 233 writer.AppendString(handle); | 230 writer.AppendString(handle); |
| 234 writer.AppendFileDescriptor(file_descriptor); | 231 writer.AppendFileDescriptor(source_file_descriptor); |
| 235 writer.AppendUint32(parent_id); | 232 writer.AppendUint32(parent_id); |
| 236 writer.AppendString(file_name); | 233 writer.AppendString(file_name); |
| 237 proxy_->CallMethod( | 234 proxy_->CallMethod( |
| 238 &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE, | 235 &method_call, dbus::ObjectProxy::TIMEOUT_INFINITE, |
| 239 base::Bind(&MediaTransferProtocolDaemonClientImpl::OnCopyFileFromLocal, | 236 base::Bind(&MediaTransferProtocolDaemonClientImpl::OnCopyFileFromLocal, |
| 240 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); | 237 weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); |
| 241 } | 238 } |
| 242 | 239 |
| 243 void DeleteObject(const std::string& handle, | 240 void DeleteObject(const std::string& handle, |
| 244 const uint32_t object_id, | 241 const uint32_t object_id, |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 515 |
| 519 MediaTransferProtocolDaemonClient::~MediaTransferProtocolDaemonClient() {} | 516 MediaTransferProtocolDaemonClient::~MediaTransferProtocolDaemonClient() {} |
| 520 | 517 |
| 521 // static | 518 // static |
| 522 MediaTransferProtocolDaemonClient* MediaTransferProtocolDaemonClient::Create( | 519 MediaTransferProtocolDaemonClient* MediaTransferProtocolDaemonClient::Create( |
| 523 dbus::Bus* bus) { | 520 dbus::Bus* bus) { |
| 524 return new MediaTransferProtocolDaemonClientImpl(bus); | 521 return new MediaTransferProtocolDaemonClientImpl(bus); |
| 525 } | 522 } |
| 526 | 523 |
| 527 } // namespace device | 524 } // namespace device |
| OLD | NEW |