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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "dbus/bus.h" | 9 #include "dbus/bus.h" |
10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 dbus::ObjectProxy* proxy_; | 402 dbus::ObjectProxy* proxy_; |
403 | 403 |
404 // Note: This should remain the last member so it'll be destroyed and | 404 // Note: This should remain the last member so it'll be destroyed and |
405 // invalidate its weak pointers before any other members are destroyed. | 405 // invalidate its weak pointers before any other members are destroyed. |
406 base::WeakPtrFactory<MediaTransferProtocolDaemonClientImpl> weak_ptr_factory_; | 406 base::WeakPtrFactory<MediaTransferProtocolDaemonClientImpl> weak_ptr_factory_; |
407 | 407 |
408 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClientImpl); | 408 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClientImpl); |
409 }; | 409 }; |
410 | 410 |
411 // A stub implementaion of MediaTransferProtocolDaemonClient. | |
412 class MediaTransferProtocolDaemonClientStubImpl | |
413 : public MediaTransferProtocolDaemonClient { | |
414 public: | |
415 MediaTransferProtocolDaemonClientStubImpl() {} | |
416 virtual ~MediaTransferProtocolDaemonClientStubImpl() {} | |
417 | |
418 virtual void EnumerateStorages( | |
419 const EnumerateStoragesCallback& callback, | |
420 const ErrorCallback& error_callback) OVERRIDE {} | |
421 virtual void GetStorageInfo( | |
422 const std::string& storage_name, | |
423 const GetStorageInfoCallback& callback, | |
424 const ErrorCallback& error_callback) OVERRIDE {} | |
425 virtual void OpenStorage(const std::string& storage_name, | |
426 const std::string& mode, | |
427 const OpenStorageCallback& callback, | |
428 const ErrorCallback& error_callback) OVERRIDE {} | |
429 virtual void CloseStorage(const std::string& handle, | |
430 const CloseStorageCallback& callback, | |
431 const ErrorCallback& error_callback) OVERRIDE {} | |
432 virtual void ReadDirectoryByPath( | |
433 const std::string& handle, | |
434 const std::string& path, | |
435 const ReadDirectoryCallback& callback, | |
436 const ErrorCallback& error_callback) OVERRIDE {} | |
437 virtual void ReadDirectoryById( | |
438 const std::string& handle, | |
439 uint32 file_id, | |
440 const ReadDirectoryCallback& callback, | |
441 const ErrorCallback& error_callback) OVERRIDE {} | |
442 virtual void ReadFileChunkByPath( | |
443 const std::string& handle, | |
444 const std::string& path, | |
445 uint32 offset, | |
446 uint32 length, | |
447 const ReadFileCallback& callback, | |
448 const ErrorCallback& error_callback) OVERRIDE {} | |
449 virtual void ReadFileChunkById( | |
450 const std::string& handle, | |
451 uint32 file_id, | |
452 uint32 offset, | |
453 uint32 length, | |
454 const ReadFileCallback& callback, | |
455 const ErrorCallback& error_callback) OVERRIDE {} | |
456 virtual void GetFileInfoByPath( | |
457 const std::string& handle, | |
458 const std::string& path, | |
459 const GetFileInfoCallback& callback, | |
460 const ErrorCallback& error_callback) OVERRIDE {} | |
461 virtual void GetFileInfoById(const std::string& handle, | |
462 uint32 file_id, | |
463 const GetFileInfoCallback& callback, | |
464 const ErrorCallback& error_callback) OVERRIDE {} | |
465 virtual void SetUpConnections( | |
466 const MTPStorageEventHandler& handler) OVERRIDE {} | |
467 | |
468 private: | |
469 DISALLOW_COPY_AND_ASSIGN(MediaTransferProtocolDaemonClientStubImpl); | |
470 }; | |
471 | |
472 } // namespace | 411 } // namespace |
473 | 412 |
474 //////////////////////////////////////////////////////////////////////////////// | 413 //////////////////////////////////////////////////////////////////////////////// |
475 // MediaTransferProtocolDaemonClient | 414 // MediaTransferProtocolDaemonClient |
476 | 415 |
477 MediaTransferProtocolDaemonClient::MediaTransferProtocolDaemonClient() {} | 416 MediaTransferProtocolDaemonClient::MediaTransferProtocolDaemonClient() {} |
478 | 417 |
479 MediaTransferProtocolDaemonClient::~MediaTransferProtocolDaemonClient() {} | 418 MediaTransferProtocolDaemonClient::~MediaTransferProtocolDaemonClient() {} |
480 | 419 |
481 // static | 420 // static |
482 MediaTransferProtocolDaemonClient* | 421 MediaTransferProtocolDaemonClient* MediaTransferProtocolDaemonClient::Create( |
483 MediaTransferProtocolDaemonClient::Create(dbus::Bus* bus, bool is_stub) { | 422 dbus::Bus* bus) { |
484 if (is_stub) | |
485 return new MediaTransferProtocolDaemonClientStubImpl(); | |
486 return new MediaTransferProtocolDaemonClientImpl(bus); | 423 return new MediaTransferProtocolDaemonClientImpl(bus); |
487 } | 424 } |
488 | 425 |
489 } // namespace device | 426 } // namespace device |
OLD | NEW |