| 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/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" | 17 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
| 18 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" | 18 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" |
| 19 #include "chrome/browser/media_galleries/gallery_watch_manager.h" | 19 #include "chrome/browser/media_galleries/gallery_watch_manager.h" |
| 20 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" | 20 #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" |
| 21 #include "chrome/browser/media_galleries/media_file_system_context.h" | 21 #include "chrome/browser/media_galleries/media_file_system_context.h" |
| 22 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" | 22 #include "chrome/browser/media_galleries/media_galleries_dialog_controller.h" |
| 23 #include "chrome/browser/media_galleries/media_galleries_histograms.h" | 23 #include "chrome/browser/media_galleries/media_galleries_histograms.h" |
| 24 #include "chrome/browser/media_galleries/media_galleries_preferences_factory.h" | 24 #include "chrome/browser/media_galleries/media_galleries_preferences_factory.h" |
| 25 #include "chrome/browser/media_galleries/media_scan_manager.h" | |
| 26 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
| 28 #include "chrome/common/extensions/extension_constants.h" | 27 #include "chrome/common/extensions/extension_constants.h" |
| 29 #include "components/keyed_service/content/browser_context_keyed_service_shutdow
n_notifier_factory.h" | 28 #include "components/keyed_service/content/browser_context_keyed_service_shutdow
n_notifier_factory.h" |
| 30 #include "components/prefs/pref_service.h" | 29 #include "components/prefs/pref_service.h" |
| 31 #include "components/storage_monitor/media_storage_util.h" | 30 #include "components/storage_monitor/media_storage_util.h" |
| 32 #include "components/storage_monitor/storage_monitor.h" | 31 #include "components/storage_monitor/storage_monitor.h" |
| 33 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 34 #include "content/public/browser/navigation_details.h" | 33 #include "content/public/browser/navigation_details.h" |
| 35 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 profile_subscription_map_[profile] = | 587 profile_subscription_map_[profile] = |
| 589 ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe( | 588 ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe( |
| 590 base::Bind(&MediaFileSystemRegistry::OnProfileShutdown, | 589 base::Bind(&MediaFileSystemRegistry::OnProfileShutdown, |
| 591 base::Unretained(this), profile)); | 590 base::Unretained(this), profile)); |
| 592 media_galleries::UsageCount(media_galleries::PROFILES_WITH_USAGE); | 591 media_galleries::UsageCount(media_galleries::PROFILES_WITH_USAGE); |
| 593 } | 592 } |
| 594 | 593 |
| 595 return MediaGalleriesPreferencesFactory::GetForProfile(profile); | 594 return MediaGalleriesPreferencesFactory::GetForProfile(profile); |
| 596 } | 595 } |
| 597 | 596 |
| 598 MediaScanManager* MediaFileSystemRegistry::media_scan_manager() { | |
| 599 if (!media_scan_manager_) | |
| 600 media_scan_manager_.reset(new MediaScanManager); | |
| 601 return media_scan_manager_.get(); | |
| 602 } | |
| 603 | |
| 604 GalleryWatchManager* MediaFileSystemRegistry::gallery_watch_manager() { | 597 GalleryWatchManager* MediaFileSystemRegistry::gallery_watch_manager() { |
| 605 if (!gallery_watch_manager_) | 598 if (!gallery_watch_manager_) |
| 606 gallery_watch_manager_.reset(new GalleryWatchManager); | 599 gallery_watch_manager_.reset(new GalleryWatchManager); |
| 607 return gallery_watch_manager_.get(); | 600 return gallery_watch_manager_.get(); |
| 608 } | 601 } |
| 609 | 602 |
| 610 void MediaFileSystemRegistry::OnRemovableStorageDetached( | 603 void MediaFileSystemRegistry::OnRemovableStorageDetached( |
| 611 const StorageInfo& info) { | 604 const StorageInfo& info) { |
| 612 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 605 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 613 | 606 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 874 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 882 | 875 |
| 883 auto extension_hosts_it = extension_hosts_map_.find(profile); | 876 auto extension_hosts_it = extension_hosts_map_.find(profile); |
| 884 DCHECK(extension_hosts_it != extension_hosts_map_.end()); | 877 DCHECK(extension_hosts_it != extension_hosts_map_.end()); |
| 885 extension_hosts_map_.erase(extension_hosts_it); | 878 extension_hosts_map_.erase(extension_hosts_it); |
| 886 | 879 |
| 887 auto profile_subscription_it = profile_subscription_map_.find(profile); | 880 auto profile_subscription_it = profile_subscription_map_.find(profile); |
| 888 DCHECK(profile_subscription_it != profile_subscription_map_.end()); | 881 DCHECK(profile_subscription_it != profile_subscription_map_.end()); |
| 889 profile_subscription_map_.erase(profile_subscription_it); | 882 profile_subscription_map_.erase(profile_subscription_it); |
| 890 } | 883 } |
| OLD | NEW |