| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 profile_subscription_map_[profile] = | 585 profile_subscription_map_[profile] = |
| 587 ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe( | 586 ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe( |
| 588 base::Bind(&MediaFileSystemRegistry::OnProfileShutdown, | 587 base::Bind(&MediaFileSystemRegistry::OnProfileShutdown, |
| 589 base::Unretained(this), profile)); | 588 base::Unretained(this), profile)); |
| 590 media_galleries::UsageCount(media_galleries::PROFILES_WITH_USAGE); | 589 media_galleries::UsageCount(media_galleries::PROFILES_WITH_USAGE); |
| 591 } | 590 } |
| 592 | 591 |
| 593 return MediaGalleriesPreferencesFactory::GetForProfile(profile); | 592 return MediaGalleriesPreferencesFactory::GetForProfile(profile); |
| 594 } | 593 } |
| 595 | 594 |
| 596 MediaScanManager* MediaFileSystemRegistry::media_scan_manager() { | |
| 597 if (!media_scan_manager_) | |
| 598 media_scan_manager_.reset(new MediaScanManager); | |
| 599 return media_scan_manager_.get(); | |
| 600 } | |
| 601 | |
| 602 GalleryWatchManager* MediaFileSystemRegistry::gallery_watch_manager() { | 595 GalleryWatchManager* MediaFileSystemRegistry::gallery_watch_manager() { |
| 603 if (!gallery_watch_manager_) | 596 if (!gallery_watch_manager_) |
| 604 gallery_watch_manager_.reset(new GalleryWatchManager); | 597 gallery_watch_manager_.reset(new GalleryWatchManager); |
| 605 return gallery_watch_manager_.get(); | 598 return gallery_watch_manager_.get(); |
| 606 } | 599 } |
| 607 | 600 |
| 608 void MediaFileSystemRegistry::OnRemovableStorageDetached( | 601 void MediaFileSystemRegistry::OnRemovableStorageDetached( |
| 609 const StorageInfo& info) { | 602 const StorageInfo& info) { |
| 610 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 603 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 611 | 604 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 872 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 880 | 873 |
| 881 auto extension_hosts_it = extension_hosts_map_.find(profile); | 874 auto extension_hosts_it = extension_hosts_map_.find(profile); |
| 882 DCHECK(extension_hosts_it != extension_hosts_map_.end()); | 875 DCHECK(extension_hosts_it != extension_hosts_map_.end()); |
| 883 extension_hosts_map_.erase(extension_hosts_it); | 876 extension_hosts_map_.erase(extension_hosts_it); |
| 884 | 877 |
| 885 auto profile_subscription_it = profile_subscription_map_.find(profile); | 878 auto profile_subscription_it = profile_subscription_map_.find(profile); |
| 886 DCHECK(profile_subscription_it != profile_subscription_map_.end()); | 879 DCHECK(profile_subscription_it != profile_subscription_map_.end()); |
| 887 profile_subscription_map_.erase(profile_subscription_it); | 880 profile_subscription_map_.erase(profile_subscription_it); |
| 888 } | 881 } |
| OLD | NEW |