Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: chrome/browser/media_galleries/media_galleries_preferences.h

Issue 25539003: Media Galleries API: Fix MediaGalleriesPreferences initialization for fresh profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 if this is a fresh profile. 243 // Populates the default galleries. Call only on fresh profiles.
244 void AddDefaultGalleriesIfFreshProfile(); 244 void AddDefaultGalleries();
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 need_to_add_default_galleries);
vandebo (ex-Chrome) 2013/10/01 22:19:01 nit: add_default_galleries
tommycli 2013/10/01 23:20:37 Done.
258
257 // Handle an iPhoto, iTunes, or Picasa finder returning a device ID to us. 259 // Handle an iPhoto, iTunes, or Picasa finder returning a device ID to us.
258 void OnFinderDeviceID(const std::string& device_id); 260 void OnFinderDeviceID(const std::string& device_id);
259 261
260 // Builds |known_galleries_| from the persistent store. 262 // Builds |known_galleries_| from the persistent store.
261 void InitFromPrefs(); 263 void InitFromPrefs();
262 264
263 MediaGalleryPrefId AddGalleryInternal(const std::string& device_id, 265 MediaGalleryPrefId AddGalleryInternal(const std::string& device_id,
264 const string16& display_name, 266 const string16& display_name,
265 const base::FilePath& relative_path, 267 const base::FilePath& relative_path,
266 bool user_added, 268 bool user_added,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // A mapping from device id to the set of gallery pref ids on that device. 323 // A mapping from device id to the set of gallery pref ids on that device.
322 // All pref ids in |device_map_| are also in |known_galleries_|. 324 // All pref ids in |device_map_| are also in |known_galleries_|.
323 DeviceIdPrefIdsMap device_map_; 325 DeviceIdPrefIdsMap device_map_;
324 326
325 ObserverList<GalleryChangeObserver> gallery_change_observers_; 327 ObserverList<GalleryChangeObserver> gallery_change_observers_;
326 328
327 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences); 329 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferences);
328 }; 330 };
329 331
330 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_ 332 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_PREFERENCES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698