OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/media_galleries/linux/mtp_device_task_helper_map_servic
e.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_device_task_helper_map_servic
e.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/media_galleries/linux/mtp_device_task_helper.h" | 9 #include "chrome/browser/media_galleries/linux/mtp_device_task_helper.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 return g_mtp_device_task_helper_map_service.Pointer(); | 21 return g_mtp_device_task_helper_map_service.Pointer(); |
22 } | 22 } |
23 | 23 |
24 MTPDeviceTaskHelper* MTPDeviceTaskHelperMapService::CreateDeviceTaskHelper( | 24 MTPDeviceTaskHelper* MTPDeviceTaskHelperMapService::CreateDeviceTaskHelper( |
25 const std::string& storage_name, | 25 const std::string& storage_name, |
26 const bool read_only) { | 26 const bool read_only) { |
27 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 27 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
28 DCHECK(!storage_name.empty()); | 28 DCHECK(!storage_name.empty()); |
29 const MTPDeviceTaskHelperKey key = | 29 const MTPDeviceTaskHelperKey key = |
30 GetMTPDeviceTaskHelperKey(storage_name, read_only); | 30 GetMTPDeviceTaskHelperKey(storage_name, read_only); |
31 DCHECK(!ContainsKey(task_helper_map_, key)); | 31 DCHECK(!base::ContainsKey(task_helper_map_, key)); |
32 MTPDeviceTaskHelper* task_helper = new MTPDeviceTaskHelper(); | 32 MTPDeviceTaskHelper* task_helper = new MTPDeviceTaskHelper(); |
33 task_helper_map_[key] = task_helper; | 33 task_helper_map_[key] = task_helper; |
34 return task_helper; | 34 return task_helper; |
35 } | 35 } |
36 | 36 |
37 void MTPDeviceTaskHelperMapService::DestroyDeviceTaskHelper( | 37 void MTPDeviceTaskHelperMapService::DestroyDeviceTaskHelper( |
38 const std::string& storage_name, | 38 const std::string& storage_name, |
39 const bool read_only) { | 39 const bool read_only) { |
40 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 40 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
41 const MTPDeviceTaskHelperKey key = | 41 const MTPDeviceTaskHelperKey key = |
(...skipping 23 matching lines...) Expand all Loading... |
65 const bool read_only) { | 65 const bool read_only) { |
66 return (read_only ? "ReadOnly" : "ReadWrite") + std::string("|") + | 66 return (read_only ? "ReadOnly" : "ReadWrite") + std::string("|") + |
67 storage_name; | 67 storage_name; |
68 } | 68 } |
69 | 69 |
70 MTPDeviceTaskHelperMapService::MTPDeviceTaskHelperMapService() { | 70 MTPDeviceTaskHelperMapService::MTPDeviceTaskHelperMapService() { |
71 } | 71 } |
72 | 72 |
73 MTPDeviceTaskHelperMapService::~MTPDeviceTaskHelperMapService() { | 73 MTPDeviceTaskHelperMapService::~MTPDeviceTaskHelperMapService() { |
74 } | 74 } |
OLD | NEW |