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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_CHROMEOS_MTP_DEVICE_TASK_HELPER_MAP_SERVI
CE_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_CHROMEOS_MTP_DEVICE_TASK_HELPER_MAP_SERVI
CE_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_CHROMEOS_MTP_DEVICE_TASK_HELPER_MAP_SERVI
CE_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_CHROMEOS_MTP_DEVICE_TASK_HELPER_MAP_SERVI
CE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 const bool read_only); | 31 const bool read_only); |
32 | 32 |
33 // Gets the MTPDeviceTaskHelper object associated with the device storage. | 33 // Gets the MTPDeviceTaskHelper object associated with the device storage. |
34 // |storage_name| specifies the name of the storage device. | 34 // |storage_name| specifies the name of the storage device. |
35 // Return NULL if the |storage_name| is no longer valid (e.g. because the | 35 // Return NULL if the |storage_name| is no longer valid (e.g. because the |
36 // corresponding storage device is detached, etc). | 36 // corresponding storage device is detached, etc). |
37 MTPDeviceTaskHelper* GetDeviceTaskHelper(const std::string& storage_name, | 37 MTPDeviceTaskHelper* GetDeviceTaskHelper(const std::string& storage_name, |
38 const bool read_only); | 38 const bool read_only); |
39 | 39 |
40 private: | 40 private: |
41 friend struct base::DefaultLazyInstanceTraits<MTPDeviceTaskHelperMapService>; | 41 friend struct base::LazyInstanceTraitsBase<MTPDeviceTaskHelperMapService>; |
42 | 42 |
43 // A key to be used in TaskHelperMap. | 43 // A key to be used in TaskHelperMap. |
44 typedef std::string MTPDeviceTaskHelperKey; | 44 typedef std::string MTPDeviceTaskHelperKey; |
45 | 45 |
46 // Gets a key from |storage_name| and |read_only|. | 46 // Gets a key from |storage_name| and |read_only|. |
47 static MTPDeviceTaskHelperKey GetMTPDeviceTaskHelperKey( | 47 static MTPDeviceTaskHelperKey GetMTPDeviceTaskHelperKey( |
48 const std::string& storage_name, | 48 const std::string& storage_name, |
49 const bool read_only); | 49 const bool read_only); |
50 | 50 |
51 // Key: A combined value with storage_name and read_only. | 51 // Key: A combined value with storage_name and read_only. |
52 // Value: MTPDeviceTaskHelper object. | 52 // Value: MTPDeviceTaskHelper object. |
53 typedef std::map<MTPDeviceTaskHelperKey, MTPDeviceTaskHelper*> TaskHelperMap; | 53 typedef std::map<MTPDeviceTaskHelperKey, MTPDeviceTaskHelper*> TaskHelperMap; |
54 | 54 |
55 // Get access to this class using GetInstance() method. | 55 // Get access to this class using GetInstance() method. |
56 MTPDeviceTaskHelperMapService(); | 56 MTPDeviceTaskHelperMapService(); |
57 ~MTPDeviceTaskHelperMapService(); | 57 ~MTPDeviceTaskHelperMapService(); |
58 | 58 |
59 // Mapping of |storage_name| and MTPDeviceTaskHelper*. | 59 // Mapping of |storage_name| and MTPDeviceTaskHelper*. |
60 // TaskHelperMap owns MTPDeviceTaskHelper objects. | 60 // TaskHelperMap owns MTPDeviceTaskHelper objects. |
61 TaskHelperMap task_helper_map_; | 61 TaskHelperMap task_helper_map_; |
62 | 62 |
63 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelperMapService); | 63 DISALLOW_COPY_AND_ASSIGN(MTPDeviceTaskHelperMapService); |
64 }; | 64 }; |
65 | 65 |
66 #endif // CHROME_BROWSER_MEDIA_GALLERIES_CHROMEOS_MTP_DEVICE_TASK_HELPER_MAP_SE
RVICE_H_ | 66 #endif // CHROME_BROWSER_MEDIA_GALLERIES_CHROMEOS_MTP_DEVICE_TASK_HELPER_MAP_SE
RVICE_H_ |
OLD | NEW |