Chromium Code Reviews| 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/fileapi/media/mtp_device_map_service.h" | 5 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" | |
| 11 #include "webkit/fileapi/isolated_context.h" | 12 #include "webkit/fileapi/isolated_context.h" |
| 12 #include "webkit/fileapi/media/mtp_device_async_delegate.h" | |
| 13 | 13 |
| 14 namespace fileapi { | 14 namespace chrome { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 base::LazyInstance<MTPDeviceMapService> g_mtp_device_map_service = | 18 base::LazyInstance<MTPDeviceMapService> g_mtp_device_map_service = |
| 19 LAZY_INSTANCE_INITIALIZER; | 19 LAZY_INSTANCE_INITIALIZER; |
| 20 | 20 |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 MTPDeviceMapService* MTPDeviceMapService::GetInstance() { | 24 MTPDeviceMapService* MTPDeviceMapService::GetInstance() { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 45 AsyncDelegateMap::iterator it = async_delegate_map_.find(device_location); | 45 AsyncDelegateMap::iterator it = async_delegate_map_.find(device_location); |
| 46 DCHECK(it != async_delegate_map_.end()); | 46 DCHECK(it != async_delegate_map_.end()); |
| 47 it->second->CancelPendingTasksAndDeleteDelegate(); | 47 it->second->CancelPendingTasksAndDeleteDelegate(); |
| 48 async_delegate_map_.erase(it); | 48 async_delegate_map_.erase(it); |
| 49 } | 49 } |
| 50 | 50 |
| 51 MTPDeviceAsyncDelegate* MTPDeviceMapService::GetMTPDeviceAsyncDelegate( | 51 MTPDeviceAsyncDelegate* MTPDeviceMapService::GetMTPDeviceAsyncDelegate( |
| 52 const std::string& filesystem_id) { | 52 const std::string& filesystem_id) { |
| 53 DCHECK(thread_checker_.CalledOnValidThread()); | 53 DCHECK(thread_checker_.CalledOnValidThread()); |
| 54 base::FilePath device_path; | 54 base::FilePath device_path; |
| 55 if (!IsolatedContext::GetInstance()->GetRegisteredPath(filesystem_id, | 55 if (!fileapi::IsolatedContext::GetInstance()->GetRegisteredPath( |
| 56 &device_path)) { | 56 filesystem_id, &device_path)) { |
|
vandebo (ex-Chrome)
2013/04/22 22:32:28
nit: four more spaces.
tommycli
2013/04/22 23:45:31
Done.
| |
| 57 return NULL; | 57 return NULL; |
| 58 } | 58 } |
| 59 | 59 |
| 60 const base::FilePath::StringType& device_location = device_path.value(); | 60 const base::FilePath::StringType& device_location = device_path.value(); |
| 61 DCHECK(!device_location.empty()); | 61 DCHECK(!device_location.empty()); |
| 62 AsyncDelegateMap::const_iterator it = | 62 AsyncDelegateMap::const_iterator it = |
| 63 async_delegate_map_.find(device_location); | 63 async_delegate_map_.find(device_location); |
| 64 return (it != async_delegate_map_.end()) ? it->second : NULL; | 64 return (it != async_delegate_map_.end()) ? it->second : NULL; |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 MTPDeviceMapService::MTPDeviceMapService() { | 68 MTPDeviceMapService::MTPDeviceMapService() { |
| 69 } | 69 } |
| 70 | 70 |
| 71 MTPDeviceMapService::~MTPDeviceMapService() {} | 71 MTPDeviceMapService::~MTPDeviceMapService() {} |
| 72 | 72 |
| 73 } // namespace fileapi | 73 } // namespace chrome |
| OLD | NEW |