| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/logging.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 18 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 19 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 19 #include "chrome/browser/media_galleries/gallery_watch_manager.h" | 20 #include "chrome/browser/media_galleries/gallery_watch_manager.h" |
| 20 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" | 21 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" |
| 21 #include "chrome/browser/media_galleries/media_file_system_context.h" | 22 #include "chrome/browser/media_galleries/media_file_system_context.h" |
| 22 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" | 23 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" |
| 23 #include "chrome/browser/media_galleries/media_galleries_histograms.h" | 24 #include "chrome/browser/media_galleries/media_galleries_histograms.h" |
| 24 #include "chrome/browser/media_galleries/media_galleries_preferences_factory.h" | 25 #include "chrome/browser/media_galleries/media_galleries_preferences_factory.h" |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl); | 755 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl); |
| 755 }; | 756 }; |
| 756 | 757 |
| 757 // Constructor in 'private' section because depends on private class definition. | 758 // Constructor in 'private' section because depends on private class definition. |
| 758 MediaFileSystemRegistry::MediaFileSystemRegistry() | 759 MediaFileSystemRegistry::MediaFileSystemRegistry() |
| 759 : file_system_context_(new MediaFileSystemContextImpl) { | 760 : file_system_context_(new MediaFileSystemContextImpl) { |
| 760 StorageMonitor::GetInstance()->AddObserver(this); | 761 StorageMonitor::GetInstance()->AddObserver(this); |
| 761 } | 762 } |
| 762 | 763 |
| 763 MediaFileSystemRegistry::~MediaFileSystemRegistry() { | 764 MediaFileSystemRegistry::~MediaFileSystemRegistry() { |
| 764 // TODO(gbillock): This is needed because the unit test uses the | 765 DCHECK(StorageMonitor::GetInstance()); |
| 765 // g_browser_process registry. We should create one in the unit test, | 766 StorageMonitor::GetInstance()->RemoveObserver(this); |
| 766 // and then can remove this. | |
| 767 if (StorageMonitor::GetInstance()) | |
| 768 StorageMonitor::GetInstance()->RemoveObserver(this); | |
| 769 } | 767 } |
| 770 | 768 |
| 771 void MediaFileSystemRegistry::OnPermissionRemoved( | 769 void MediaFileSystemRegistry::OnPermissionRemoved( |
| 772 MediaGalleriesPreferences* prefs, | 770 MediaGalleriesPreferences* prefs, |
| 773 const std::string& extension_id, | 771 const std::string& extension_id, |
| 774 MediaGalleryPrefId pref_id) { | 772 MediaGalleryPrefId pref_id) { |
| 775 Profile* profile = prefs->profile(); | 773 Profile* profile = prefs->profile(); |
| 776 ExtensionGalleriesHostMap::const_iterator host_map_it = | 774 ExtensionGalleriesHostMap::const_iterator host_map_it = |
| 777 extension_hosts_map_.find(profile); | 775 extension_hosts_map_.find(profile); |
| 778 DCHECK(host_map_it != extension_hosts_map_.end()); | 776 DCHECK(host_map_it != extension_hosts_map_.end()); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 868 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 871 | 869 |
| 872 auto extension_hosts_it = extension_hosts_map_.find(profile); | 870 auto extension_hosts_it = extension_hosts_map_.find(profile); |
| 873 DCHECK(extension_hosts_it != extension_hosts_map_.end()); | 871 DCHECK(extension_hosts_it != extension_hosts_map_.end()); |
| 874 extension_hosts_map_.erase(extension_hosts_it); | 872 extension_hosts_map_.erase(extension_hosts_it); |
| 875 | 873 |
| 876 auto profile_subscription_it = profile_subscription_map_.find(profile); | 874 auto profile_subscription_it = profile_subscription_map_.find(profile); |
| 877 DCHECK(profile_subscription_it != profile_subscription_map_.end()); | 875 DCHECK(profile_subscription_it != profile_subscription_map_.end()); |
| 878 profile_subscription_map_.erase(profile_subscription_it); | 876 profile_subscription_map_.erase(profile_subscription_it); |
| 879 } | 877 } |
| OLD | NEW |