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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/base_paths_posix.h" | 9 #include "base/base_paths_posix.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 DCHECK(IsInitialized()); | 828 DCHECK(IsInitialized()); |
829 DCHECK(extension); | 829 DCHECK(extension); |
830 if (!include_unpermitted_galleries && | 830 if (!include_unpermitted_galleries && |
831 !ContainsKey(GalleriesForExtension(*extension), gallery_id)) | 831 !ContainsKey(GalleriesForExtension(*extension), gallery_id)) |
832 return base::FilePath(); | 832 return base::FilePath(); |
833 | 833 |
834 MediaGalleriesPrefInfoMap::const_iterator it = | 834 MediaGalleriesPrefInfoMap::const_iterator it = |
835 known_galleries_.find(gallery_id); | 835 known_galleries_.find(gallery_id); |
836 if (it == known_galleries_.end()) | 836 if (it == known_galleries_.end()) |
837 return base::FilePath(); | 837 return base::FilePath(); |
| 838 |
| 839 // This seems wrong: it just returns the absolute path to the device, which |
| 840 // is not necessarily the gallery path. |
838 return MediaStorageUtil::FindDevicePathById(it->second.device_id); | 841 return MediaStorageUtil::FindDevicePathById(it->second.device_id); |
839 } | 842 } |
840 | 843 |
841 MediaGalleryPrefId MediaGalleriesPreferences::AddGallery( | 844 MediaGalleryPrefId MediaGalleriesPreferences::AddGallery( |
842 const std::string& device_id, | 845 const std::string& device_id, |
843 const base::FilePath& relative_path, | 846 const base::FilePath& relative_path, |
844 MediaGalleryPrefInfo::Type type, | 847 MediaGalleryPrefInfo::Type type, |
845 const base::string16& volume_label, | 848 const base::string16& volume_label, |
846 const base::string16& vendor_name, | 849 const base::string16& vendor_name, |
847 const base::string16& model_name, | 850 const base::string16& model_name, |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 if (extension_prefs_for_testing_) | 1453 if (extension_prefs_for_testing_) |
1451 return extension_prefs_for_testing_; | 1454 return extension_prefs_for_testing_; |
1452 return extensions::ExtensionPrefs::Get(profile_); | 1455 return extensions::ExtensionPrefs::Get(profile_); |
1453 } | 1456 } |
1454 | 1457 |
1455 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( | 1458 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( |
1456 extensions::ExtensionPrefs* extension_prefs) { | 1459 extensions::ExtensionPrefs* extension_prefs) { |
1457 DCHECK(IsInitialized()); | 1460 DCHECK(IsInitialized()); |
1458 extension_prefs_for_testing_ = extension_prefs; | 1461 extension_prefs_for_testing_ = extension_prefs; |
1459 } | 1462 } |
OLD | NEW |