| 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_file_system_registry.h" | 5 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 StorageInfo::IsRemovableDevice(device_id), | 457 StorageInfo::IsRemovableDevice(device_id), |
| 458 StorageInfo::IsMediaDevice(device_id)); | 458 StorageInfo::IsMediaDevice(device_id)); |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 if (pref_id_map_.empty()) { | 462 if (pref_id_map_.empty()) { |
| 463 rph_refs_.Reset(); | 463 rph_refs_.Reset(); |
| 464 CleanUp(); | 464 CleanUp(); |
| 465 } | 465 } |
| 466 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 466 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 467 base::Bind(callback, result)); | 467 base::BindOnce(callback, result)); |
| 468 } | 468 } |
| 469 | 469 |
| 470 std::string GetTransientIdForRemovableDeviceId(const std::string& device_id) { | 470 std::string GetTransientIdForRemovableDeviceId(const std::string& device_id) { |
| 471 if (!StorageInfo::IsRemovableDevice(device_id)) | 471 if (!StorageInfo::IsRemovableDevice(device_id)) |
| 472 return std::string(); | 472 return std::string(); |
| 473 | 473 |
| 474 return StorageMonitor::GetInstance()->GetTransientIdForDeviceId(device_id); | 474 return StorageMonitor::GetInstance()->GetTransientIdForDeviceId(device_id); |
| 475 } | 475 } |
| 476 | 476 |
| 477 void CleanUp() { | 477 void CleanUp() { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 MediaGalleriesPreferences* preferences = GetPreferences(profile); | 553 MediaGalleriesPreferences* preferences = GetPreferences(profile); |
| 554 MediaGalleriesPrefInfoMap::const_iterator gallery = | 554 MediaGalleriesPrefInfoMap::const_iterator gallery = |
| 555 preferences->known_galleries().find(pref_id); | 555 preferences->known_galleries().find(pref_id); |
| 556 MediaGalleryPrefIdSet permitted_galleries = | 556 MediaGalleryPrefIdSet permitted_galleries = |
| 557 preferences->GalleriesForExtension(*extension); | 557 preferences->GalleriesForExtension(*extension); |
| 558 | 558 |
| 559 if (gallery == preferences->known_galleries().end() || | 559 if (gallery == preferences->known_galleries().end() || |
| 560 !base::ContainsKey(permitted_galleries, pref_id)) { | 560 !base::ContainsKey(permitted_galleries, pref_id)) { |
| 561 BrowserThread::PostTask( | 561 BrowserThread::PostTask( |
| 562 BrowserThread::IO, FROM_HERE, | 562 BrowserThread::IO, FROM_HERE, |
| 563 base::Bind(callback, base::File::FILE_ERROR_NOT_FOUND)); | 563 base::BindOnce(callback, base::File::FILE_ERROR_NOT_FOUND)); |
| 564 return; | 564 return; |
| 565 } | 565 } |
| 566 | 566 |
| 567 ExtensionGalleriesHost* extension_host = | 567 ExtensionGalleriesHost* extension_host = |
| 568 GetExtensionGalleryHost(profile, preferences, extension->id()); | 568 GetExtensionGalleryHost(profile, preferences, extension->id()); |
| 569 | 569 |
| 570 // This must come before the GetMediaFileSystems call to make sure the | 570 // This must come before the GetMediaFileSystems call to make sure the |
| 571 // contents of the context is referenced before the filesystems are retrieved. | 571 // contents of the context is referenced before the filesystems are retrieved. |
| 572 extension_host->ReferenceFromWebContents(contents); | 572 extension_host->ReferenceFromWebContents(contents); |
| 573 | 573 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 868 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 869 | 869 |
| 870 auto extension_hosts_it = extension_hosts_map_.find(profile); | 870 auto extension_hosts_it = extension_hosts_map_.find(profile); |
| 871 DCHECK(extension_hosts_it != extension_hosts_map_.end()); | 871 DCHECK(extension_hosts_it != extension_hosts_map_.end()); |
| 872 extension_hosts_map_.erase(extension_hosts_it); | 872 extension_hosts_map_.erase(extension_hosts_it); |
| 873 | 873 |
| 874 auto profile_subscription_it = profile_subscription_map_.find(profile); | 874 auto profile_subscription_it = profile_subscription_map_.find(profile); |
| 875 DCHECK(profile_subscription_it != profile_subscription_map_.end()); | 875 DCHECK(profile_subscription_it != profile_subscription_map_.end()); |
| 876 profile_subscription_map_.erase(profile_subscription_it); | 876 profile_subscription_map_.erase(profile_subscription_it); |
| 877 } | 877 } |
| OLD | NEW |