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 #include "chrome/browser/media_galleries/media_galleries_preferences.h" | 5 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 return base_path.empty() ? base_path : base_path.Append(path); | 209 return base_path.empty() ? base_path : base_path.Append(path); |
210 } | 210 } |
211 | 211 |
212 MediaGalleriesPreferences::GalleryChangeObserver::~GalleryChangeObserver() {} | 212 MediaGalleriesPreferences::GalleryChangeObserver::~GalleryChangeObserver() {} |
213 | 213 |
214 MediaGalleriesPreferences::MediaGalleriesPreferences(Profile* profile) | 214 MediaGalleriesPreferences::MediaGalleriesPreferences(Profile* profile) |
215 : weak_factory_(this), | 215 : weak_factory_(this), |
216 profile_(profile) { | 216 profile_(profile) { |
217 AddDefaultGalleriesIfFreshProfile(); | 217 AddDefaultGalleriesIfFreshProfile(); |
218 | 218 |
219 // TODO(vandebo) Turn this back on when the iTunes code is ready. | |
220 // Temporarily turned off because it adds an extra user-visible entry to the | |
221 // preferences that does not quite work. | |
222 #if 0 | |
223 // Look for optional default galleries every time. | 219 // Look for optional default galleries every time. |
224 itunes::ITunesFinder::FindITunesLibrary( | 220 itunes::ITunesFinder::FindITunesLibrary( |
225 base::Bind(&MediaGalleriesPreferences::OnITunesDeviceID, | 221 base::Bind(&MediaGalleriesPreferences::OnITunesDeviceID, |
226 weak_factory_.GetWeakPtr())); | 222 weak_factory_.GetWeakPtr())); |
227 #endif | |
228 | 223 |
229 // TODO(tommycli): Turn on when Picasa code is ready. | 224 // TODO(tommycli): Turn on when Picasa code is ready. |
230 #if 0 | 225 #if 0 |
231 picasa::PicasaFinder::FindPicasaDatabaseOnUIThread( | 226 picasa::PicasaFinder::FindPicasaDatabaseOnUIThread( |
232 base::Bind(&MediaGalleriesPreferences::OnPicasaDeviceID, | 227 base::Bind(&MediaGalleriesPreferences::OnPicasaDeviceID, |
233 weak_factory_.GetWeakPtr())); | 228 weak_factory_.GetWeakPtr())); |
234 #endif | 229 #endif |
235 | 230 |
236 InitFromPrefs(false /*no notification*/); | 231 InitFromPrefs(false /*no notification*/); |
237 | 232 |
(...skipping 26 matching lines...) Expand all Loading... |
264 if (MediaStorageUtil::GetDeviceInfoFromPath(path, &info, &relative_path)) { | 259 if (MediaStorageUtil::GetDeviceInfoFromPath(path, &info, &relative_path)) { |
265 // TODO(gbillock): Add in the volume metadata here when available. | 260 // TODO(gbillock): Add in the volume metadata here when available. |
266 AddGalleryWithName(info.device_id(), info.name(), relative_path, | 261 AddGalleryWithName(info.device_id(), info.name(), relative_path, |
267 false /*user added*/); | 262 false /*user added*/); |
268 } | 263 } |
269 } | 264 } |
270 } | 265 } |
271 | 266 |
272 void MediaGalleriesPreferences::OnITunesDeviceID(const std::string& device_id) { | 267 void MediaGalleriesPreferences::OnITunesDeviceID(const std::string& device_id) { |
273 DCHECK(!device_id.empty()); | 268 DCHECK(!device_id.empty()); |
| 269 // TODO(vandebo): Amend any existing iTunes gallery instead of adding anew. |
274 AddGalleryWithName(device_id, ASCIIToUTF16(kITunesGalleryName), | 270 AddGalleryWithName(device_id, ASCIIToUTF16(kITunesGalleryName), |
275 base::FilePath(), false /*not user added*/); | 271 base::FilePath(), false /*not user added*/); |
276 } | 272 } |
277 | 273 |
278 void MediaGalleriesPreferences::OnPicasaDeviceID(const std::string& device_id) { | 274 void MediaGalleriesPreferences::OnPicasaDeviceID(const std::string& device_id) { |
279 // TODO(tommycli): Implement support for location moves. | 275 // TODO(tommycli): Implement support for location moves. |
280 DCHECK(!device_id.empty()); | 276 DCHECK(!device_id.empty()); |
281 AddGalleryWithName(device_id, ASCIIToUTF16(kPicasaGalleryName), | 277 AddGalleryWithName(device_id, ASCIIToUTF16(kPicasaGalleryName), |
282 base::FilePath(), false /*not user added*/); | 278 base::FilePath(), false /*not user added*/); |
283 } | 279 } |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 } | 695 } |
700 | 696 |
701 extensions::ExtensionPrefs* | 697 extensions::ExtensionPrefs* |
702 MediaGalleriesPreferences::GetExtensionPrefs() const { | 698 MediaGalleriesPreferences::GetExtensionPrefs() const { |
703 ExtensionService* extension_service = | 699 ExtensionService* extension_service = |
704 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 700 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
705 return extension_service->extension_prefs(); | 701 return extension_service->extension_prefs(); |
706 } | 702 } |
707 | 703 |
708 } // namespace chrome | 704 } // namespace chrome |
OLD | NEW |