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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 friend class MediaGalleriesPreferencesTest; | 233 friend class MediaGalleriesPreferencesTest; |
234 friend class MediaGalleriesPermissionsTest; | 234 friend class MediaGalleriesPermissionsTest; |
235 | 235 |
236 typedef std::map<std::string /*device id*/, MediaGalleryPrefIdSet> | 236 typedef std::map<std::string /*device id*/, MediaGalleryPrefIdSet> |
237 DeviceIdPrefIdsMap; | 237 DeviceIdPrefIdsMap; |
238 | 238 |
239 // These must be called on the UI thread. | 239 // These must be called on the UI thread. |
240 void OnInitializationCallbackReturned(); | 240 void OnInitializationCallbackReturned(); |
241 void FinishInitialization(); | 241 void FinishInitialization(); |
242 | 242 |
243 // Populates the default galleries. Call only on fresh profiles. | 243 // Populates the default galleries if this is a fresh profile. |
244 void AddDefaultGalleries(); | 244 void AddDefaultGalleriesIfFreshProfile(); |
245 | 245 |
246 // This is a hack - Some devices (iTunes, Picasa) are singletons in that only | 246 // This is a hack - Some devices (iTunes, Picasa) are singletons in that only |
247 // one instance of that type is supported at a time. As such, the device id | 247 // one instance of that type is supported at a time. As such, the device id |
248 // should just be "itunes:" or "picasa:" but that would mean finding the | 248 // should just be "itunes:" or "picasa:" but that would mean finding the |
249 // location of the database file multiple times, which may be an async | 249 // location of the database file multiple times, which may be an async |
250 // operation. Storing the location of the backing database in the device | 250 // operation. Storing the location of the backing database in the device |
251 // id allows that look up to be avoided. However, the cost is that if the | 251 // id allows that look up to be avoided. However, the cost is that if the |
252 // database moves, the device id in preferences has to be updated. This | 252 // database moves, the device id in preferences has to be updated. This |
253 // method searches for a gallery of the type passed in and updates its | 253 // method searches for a gallery of the type passed in and updates its |
254 // device id. It returns true if the device id is up to date. | 254 // device id. It returns true if the device id is up to date. |
255 bool UpdateDeviceIDForSingletonType(const std::string& device_id); | 255 bool UpdateDeviceIDForSingletonType(const std::string& device_id); |
256 | 256 |
257 void OnStorageMonitorInit(bool add_default_galleries); | |
258 | |
259 // Handle an iPhoto, iTunes, or Picasa finder returning a device ID to us. | 257 // Handle an iPhoto, iTunes, or Picasa finder returning a device ID to us. |
260 void OnFinderDeviceID(const std::string& device_id); | 258 void OnFinderDeviceID(const std::string& device_id); |
261 | 259 |
262 // Builds |known_galleries_| from the persistent store. | 260 // Builds |known_galleries_| from the persistent store. |
263 void InitFromPrefs(); | 261 void InitFromPrefs(); |
264 | 262 |
265 MediaGalleryPrefId AddGalleryInternal(const std::string& device_id, | 263 MediaGalleryPrefId AddGalleryInternal(const std::string& device_id, |
266 const string16& display_name, | 264 const string16& display_name, |
267 const base::FilePath& relative_path, | 265 const base::FilePath& relative_path, |
268 bool user_added, | 266 bool user_added, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // A mapping from device id to the set of gallery pref ids on that device. | 321 // A mapping from device id to the set of gallery pref ids on that device. |
324 // All pref ids in |device_map_| are also in |known_galleries_|. | 322 // All pref ids in |device_map_| are also in |known_galleries_|. |
325 DeviceIdPrefIdsMap device_map_; | 323 DeviceIdPrefIdsMap device_map_; |
326 | 324 |
327 ObserverList<GalleryChangeObserver> gallery_change_observers_; | 325 ObserverList<GalleryChangeObserver> gallery_change_observers_; |
328 | 326 |
329 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); | 327 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); |
330 }; | 328 }; |
331 | 329 |
332 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ | 330 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ |
OLD | NEW |