| 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 <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 if (!device_id.empty()) { | 663 if (!device_id.empty()) { |
| 664 std::string gallery_name; | 664 std::string gallery_name; |
| 665 if (StorageInfo::IsITunesDevice(device_id)) | 665 if (StorageInfo::IsITunesDevice(device_id)) |
| 666 gallery_name = kITunesGalleryName; | 666 gallery_name = kITunesGalleryName; |
| 667 else if (StorageInfo::IsPicasaDevice(device_id)) | 667 else if (StorageInfo::IsPicasaDevice(device_id)) |
| 668 gallery_name = kPicasaGalleryName; | 668 gallery_name = kPicasaGalleryName; |
| 669 | 669 |
| 670 if (!gallery_name.empty()) { | 670 if (!gallery_name.empty()) { |
| 671 pre_initialization_callbacks_waiting_++; | 671 pre_initialization_callbacks_waiting_++; |
| 672 content::BrowserThread::PostTaskAndReply( | 672 content::BrowserThread::PostTaskAndReply( |
| 673 content::BrowserThread::FILE, | 673 content::BrowserThread::FILE, FROM_HERE, |
| 674 FROM_HERE, | 674 base::BindOnce(&InitializeImportedMediaGalleryRegistryOnFileThread), |
| 675 base::Bind(&InitializeImportedMediaGalleryRegistryOnFileThread), | 675 base::BindOnce( |
| 676 base::Bind( | |
| 677 &MediaGalleriesPreferences::OnInitializationCallbackReturned, | 676 &MediaGalleriesPreferences::OnInitializationCallbackReturned, |
| 678 weak_factory_.GetWeakPtr())); | 677 weak_factory_.GetWeakPtr())); |
| 679 } | 678 } |
| 680 | 679 |
| 681 if (!UpdateDeviceIDForSingletonType(device_id)) { | 680 if (!UpdateDeviceIDForSingletonType(device_id)) { |
| 682 DCHECK(!gallery_name.empty()); | 681 DCHECK(!gallery_name.empty()); |
| 683 AddOrUpdateGalleryInternal( | 682 AddOrUpdateGalleryInternal( |
| 684 device_id, | 683 device_id, |
| 685 base::ASCIIToUTF16(gallery_name), | 684 base::ASCIIToUTF16(gallery_name), |
| 686 base::FilePath(), | 685 base::FilePath(), |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 if (extension_prefs_for_testing_) | 1430 if (extension_prefs_for_testing_) |
| 1432 return extension_prefs_for_testing_; | 1431 return extension_prefs_for_testing_; |
| 1433 return extensions::ExtensionPrefs::Get(profile_); | 1432 return extensions::ExtensionPrefs::Get(profile_); |
| 1434 } | 1433 } |
| 1435 | 1434 |
| 1436 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( | 1435 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( |
| 1437 extensions::ExtensionPrefs* extension_prefs) { | 1436 extensions::ExtensionPrefs* extension_prefs) { |
| 1438 DCHECK(IsInitialized()); | 1437 DCHECK(IsInitialized()); |
| 1439 extension_prefs_for_testing_ = extension_prefs; | 1438 extension_prefs_for_testing_ = extension_prefs; |
| 1440 } | 1439 } |
| OLD | NEW |