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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 // If the gallery is on a removable device, the time that device was last | 97 // If the gallery is on a removable device, the time that device was last |
98 // attached. It is stored in preferences by the base::Time internal value, | 98 // attached. It is stored in preferences by the base::Time internal value, |
99 // which is microseconds since the epoch. | 99 // which is microseconds since the epoch. |
100 base::Time last_attach_time; | 100 base::Time last_attach_time; |
101 | 101 |
102 // Set to true if the volume metadata fields (volume_label, vendor_name, | 102 // Set to true if the volume metadata fields (volume_label, vendor_name, |
103 // model_name, total_size_in_bytes) were set. False if these fields were | 103 // model_name, total_size_in_bytes) were set. False if these fields were |
104 // never written. | 104 // never written. |
105 bool volume_metadata_valid; | 105 bool volume_metadata_valid; |
106 | 106 |
107 // The following fields are populated with the image, music, and video file | |
108 // counts from the last scan if |type| is kScanResult. For files where it is | |
109 // hard to determine the exact type, the file should be counted in all | |
110 // possible counts. | |
111 int image_count; | |
112 int music_count; | |
113 int video_count; | |
114 | |
107 // 0 if the display_name is set externally and always used for display. | 115 // 0 if the display_name is set externally and always used for display. |
108 // 1 if the display_name is only set externally when it is overriding | 116 // 1 if the display_name is only set externally when it is overriding |
109 // the name constructed from volume metadata. | 117 // the name constructed from volume metadata. |
110 int prefs_version; | 118 int prefs_version; |
111 | 119 |
112 // Called by views to provide details for the gallery permission entries. | 120 // Called by views to provide details for the gallery permission entries. |
113 base::string16 GetGalleryDisplayName() const; | 121 base::string16 GetGalleryDisplayName() const; |
114 base::string16 GetGalleryTooltip() const; | 122 base::string16 GetGalleryTooltip() const; |
115 base::string16 GetGalleryAdditionalDetails() const; | 123 base::string16 GetGalleryAdditionalDetails() const; |
116 | 124 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 // Teaches the registry about a new gallery. If the gallery is in a | 204 // Teaches the registry about a new gallery. If the gallery is in a |
197 // blacklisted state, it is unblacklisted. |type| should not be a blacklisted | 205 // blacklisted state, it is unblacklisted. |type| should not be a blacklisted |
198 // type. Returns the gallery's pref id. | 206 // type. Returns the gallery's pref id. |
199 MediaGalleryPrefId AddGallery(const std::string& device_id, | 207 MediaGalleryPrefId AddGallery(const std::string& device_id, |
200 const base::FilePath& relative_path, | 208 const base::FilePath& relative_path, |
201 MediaGalleryPrefInfo::Type type, | 209 MediaGalleryPrefInfo::Type type, |
202 const base::string16& volume_label, | 210 const base::string16& volume_label, |
203 const base::string16& vendor_name, | 211 const base::string16& vendor_name, |
204 const base::string16& model_name, | 212 const base::string16& model_name, |
205 uint64 total_size_in_bytes, | 213 uint64 total_size_in_bytes, |
206 base::Time last_attach_time); | 214 base::Time last_attach_time, |
215 int image_count, | |
Lei Zhang
2014/01/15 22:13:43
The number of parameters is too damn high!
| |
216 int music_count, | |
217 int video_count); | |
207 | 218 |
208 // Teach the registry about a gallery simply from the path. If the gallery is | 219 // Teach the registry about a gallery simply from the path. If the gallery is |
209 // in a blacklisted state, it is unblacklisted. |type| should not be a | 220 // in a blacklisted state, it is unblacklisted. |type| should not be a |
210 // blacklisted type. Returns the gallery's pref id. | 221 // blacklisted type. Returns the gallery's pref id. |
211 MediaGalleryPrefId AddGalleryByPath(const base::FilePath& path, | 222 MediaGalleryPrefId AddGalleryByPath(const base::FilePath& path, |
212 MediaGalleryPrefInfo::Type type); | 223 MediaGalleryPrefInfo::Type type); |
213 | 224 |
214 // Removes the gallery identified by |id| from the store. | 225 // Removes the gallery identified by |id| from the store. |
215 void ForgetGalleryById(MediaGalleryPrefId id); | 226 void ForgetGalleryById(MediaGalleryPrefId id); |
216 | 227 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 MediaGalleryPrefId AddGalleryInternal(const std::string& device_id, | 282 MediaGalleryPrefId AddGalleryInternal(const std::string& device_id, |
272 const base::string16& display_name, | 283 const base::string16& display_name, |
273 const base::FilePath& relative_path, | 284 const base::FilePath& relative_path, |
274 MediaGalleryPrefInfo::Type type, | 285 MediaGalleryPrefInfo::Type type, |
275 const base::string16& volume_label, | 286 const base::string16& volume_label, |
276 const base::string16& vendor_name, | 287 const base::string16& vendor_name, |
277 const base::string16& model_name, | 288 const base::string16& model_name, |
278 uint64 total_size_in_bytes, | 289 uint64 total_size_in_bytes, |
279 base::Time last_attach_time, | 290 base::Time last_attach_time, |
280 bool volume_metadata_valid, | 291 bool volume_metadata_valid, |
292 int image_count, | |
293 int music_count, | |
294 int video_count, | |
281 int prefs_version); | 295 int prefs_version); |
282 | 296 |
283 // Sets permission for the media galleries identified by |gallery_id| for the | 297 // Sets permission for the media galleries identified by |gallery_id| for the |
284 // extension in the given |prefs|. Returns true only if anything changed. | 298 // extension in the given |prefs|. Returns true only if anything changed. |
285 bool SetGalleryPermissionInPrefs(const std::string& extension_id, | 299 bool SetGalleryPermissionInPrefs(const std::string& extension_id, |
286 MediaGalleryPrefId gallery_id, | 300 MediaGalleryPrefId gallery_id, |
287 bool has_access); | 301 bool has_access); |
288 | 302 |
289 // Removes the entry for the media galleries permissions identified by | 303 // Removes the entry for the media galleries permissions identified by |
290 // |gallery_id| for the extension in the given |prefs|. | 304 // |gallery_id| for the extension in the given |prefs|. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 DeviceIdPrefIdsMap device_map_; | 343 DeviceIdPrefIdsMap device_map_; |
330 | 344 |
331 ObserverList<GalleryChangeObserver> gallery_change_observers_; | 345 ObserverList<GalleryChangeObserver> gallery_change_observers_; |
332 | 346 |
333 base::WeakPtrFactory<MediaGalleriesPreferences> weak_factory_; | 347 base::WeakPtrFactory<MediaGalleriesPreferences> weak_factory_; |
334 | 348 |
335 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); | 349 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); |
336 }; | 350 }; |
337 | 351 |
338 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ | 352 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ |
OLD | NEW |