| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 DCHECK(!StorageInfo::IsMassStorageDevice(device_id)); | 715 DCHECK(!StorageInfo::IsMassStorageDevice(device_id)); |
| 716 | 716 |
| 717 // Sanity checks for |path|. | 717 // Sanity checks for |path|. |
| 718 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path)); | 718 CHECK(MediaStorageUtil::CanCreateFileSystem(device_id, path)); |
| 719 bool result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( | 719 bool result = ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( |
| 720 fs_name, | 720 fs_name, |
| 721 storage::kFileSystemTypeDeviceMedia, | 721 storage::kFileSystemTypeDeviceMedia, |
| 722 storage::FileSystemMountOption(), | 722 storage::FileSystemMountOption(), |
| 723 path); | 723 path); |
| 724 CHECK(result); | 724 CHECK(result); |
| 725 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( | 725 BrowserThread::PostTask( |
| 726 &MTPDeviceMapService::RegisterMTPFileSystem, | 726 BrowserThread::IO, FROM_HERE, |
| 727 base::Unretained(MTPDeviceMapService::GetInstance()), | 727 base::Bind(&MTPDeviceMapService::RegisterMTPFileSystem, |
| 728 path.value(), fs_name)); | 728 base::Unretained(MTPDeviceMapService::GetInstance()), |
| 729 path.value(), fs_name, true /* read only */)); |
| 729 return result; | 730 return result; |
| 730 } | 731 } |
| 731 | 732 |
| 732 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl); | 733 DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl); |
| 733 }; | 734 }; |
| 734 | 735 |
| 735 // Constructor in 'private' section because depends on private class definition. | 736 // Constructor in 'private' section because depends on private class definition. |
| 736 MediaFileSystemRegistry::MediaFileSystemRegistry() | 737 MediaFileSystemRegistry::MediaFileSystemRegistry() |
| 737 : file_system_context_(new MediaFileSystemContextImpl) { | 738 : file_system_context_(new MediaFileSystemContextImpl) { |
| 738 StorageMonitor::GetInstance()->AddObserver(this); | 739 StorageMonitor::GetInstance()->AddObserver(this); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 DCHECK_EQ(1U, erase_count); | 837 DCHECK_EQ(1U, erase_count); |
| 837 if (extension_hosts->second.empty()) { | 838 if (extension_hosts->second.empty()) { |
| 838 // When a profile has no ExtensionGalleriesHosts left, remove the | 839 // When a profile has no ExtensionGalleriesHosts left, remove the |
| 839 // matching gallery-change-watcher since it is no longer needed. Leave the | 840 // matching gallery-change-watcher since it is no longer needed. Leave the |
| 840 // |extension_hosts| entry alone, since it indicates the profile has been | 841 // |extension_hosts| entry alone, since it indicates the profile has been |
| 841 // previously used. | 842 // previously used. |
| 842 MediaGalleriesPreferences* preferences = GetPreferences(profile); | 843 MediaGalleriesPreferences* preferences = GetPreferences(profile); |
| 843 preferences->RemoveGalleryChangeObserver(this); | 844 preferences->RemoveGalleryChangeObserver(this); |
| 844 } | 845 } |
| 845 } | 846 } |
| OLD | NEW |