| 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_manager.h" | 5 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <queue> | 10 #include <queue> |
| 10 #include <set> | 11 #include <set> |
| 11 #include <utility> | 12 #include <utility> |
| 12 | 13 |
| 13 #include "base/bind.h" | 14 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 15 #include "base/location.h" | 16 #include "base/location.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "base/sequenced_task_runner.h" | 20 #include "base/sequenced_task_runner.h" |
| 21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
| 22 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "dbus/bus.h" | 24 #include "dbus/bus.h" |
| 25 #include "device/media_transfer_protocol/media_transfer_protocol_daemon_client.h
" | 25 #include "device/media_transfer_protocol/media_transfer_protocol_daemon_client.h
" |
| 26 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" | 26 #include "device/media_transfer_protocol/mtp_file_entry.pb.h" |
| 27 #include "device/media_transfer_protocol/mtp_storage_info.pb.h" | 27 #include "device/media_transfer_protocol/mtp_storage_info.pb.h" |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 mtp_client_->ListenForChanges( | 658 mtp_client_->ListenForChanges( |
| 659 base::Bind(&MediaTransferProtocolManagerImpl::OnStorageChanged, | 659 base::Bind(&MediaTransferProtocolManagerImpl::OnStorageChanged, |
| 660 weak_ptr_factory_.GetWeakPtr())); | 660 weak_ptr_factory_.GetWeakPtr())); |
| 661 mtp_client_->EnumerateStorages( | 661 mtp_client_->EnumerateStorages( |
| 662 base::Bind(&MediaTransferProtocolManagerImpl::OnEnumerateStorages, | 662 base::Bind(&MediaTransferProtocolManagerImpl::OnEnumerateStorages, |
| 663 weak_ptr_factory_.GetWeakPtr()), | 663 weak_ptr_factory_.GetWeakPtr()), |
| 664 base::Bind(&base::DoNothing)); | 664 base::Bind(&base::DoNothing)); |
| 665 } | 665 } |
| 666 | 666 |
| 667 // Mtpd DBus client. | 667 // Mtpd DBus client. |
| 668 scoped_ptr<MediaTransferProtocolDaemonClient> mtp_client_; | 668 std::unique_ptr<MediaTransferProtocolDaemonClient> mtp_client_; |
| 669 | 669 |
| 670 #if !defined(OS_CHROMEOS) | 670 #if !defined(OS_CHROMEOS) |
| 671 // And a D-Bus session for talking to mtpd. | 671 // And a D-Bus session for talking to mtpd. |
| 672 scoped_refptr<dbus::Bus> session_bus_; | 672 scoped_refptr<dbus::Bus> session_bus_; |
| 673 #endif | 673 #endif |
| 674 | 674 |
| 675 // Device attachment / detachment observers. | 675 // Device attachment / detachment observers. |
| 676 base::ObserverList<Observer> observers_; | 676 base::ObserverList<Observer> observers_; |
| 677 | 677 |
| 678 // Map to keep track of attached storages by name. | 678 // Map to keep track of attached storages by name. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 DCHECK(!g_media_transfer_protocol_manager); | 712 DCHECK(!g_media_transfer_protocol_manager); |
| 713 | 713 |
| 714 g_media_transfer_protocol_manager = | 714 g_media_transfer_protocol_manager = |
| 715 new MediaTransferProtocolManagerImpl(task_runner); | 715 new MediaTransferProtocolManagerImpl(task_runner); |
| 716 VLOG(1) << "MediaTransferProtocolManager initialized"; | 716 VLOG(1) << "MediaTransferProtocolManager initialized"; |
| 717 | 717 |
| 718 return g_media_transfer_protocol_manager; | 718 return g_media_transfer_protocol_manager; |
| 719 } | 719 } |
| 720 | 720 |
| 721 } // namespace device | 721 } // namespace device |
| OLD | NEW |