| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/file_manager/volume_manager.h" | 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 8 #include "base/bind.h" | 10 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 12 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 13 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 14 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
| 15 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 16 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 32 #include "components/drive/file_system_interface.h" | 34 #include "components/drive/file_system_interface.h" |
| 33 #include "components/storage_monitor/storage_monitor.h" | 35 #include "components/storage_monitor/storage_monitor.h" |
| 34 #include "content/public/browser/browser_context.h" | 36 #include "content/public/browser/browser_context.h" |
| 35 #include "content/public/browser/browser_thread.h" | 37 #include "content/public/browser/browser_thread.h" |
| 36 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 38 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
| 37 #include "storage/browser/fileapi/external_mount_points.h" | 39 #include "storage/browser/fileapi/external_mount_points.h" |
| 38 | 40 |
| 39 namespace file_manager { | 41 namespace file_manager { |
| 40 namespace { | 42 namespace { |
| 41 | 43 |
| 42 const uint32 kAccessCapabilityReadWrite = 0; | 44 const uint32_t kAccessCapabilityReadWrite = 0; |
| 43 const uint32 kFilesystemTypeGenericHierarchical = 2; | 45 const uint32_t kFilesystemTypeGenericHierarchical = 2; |
| 44 const char kFileManagerMTPMountNamePrefix[] = "fileman-mtp-"; | 46 const char kFileManagerMTPMountNamePrefix[] = "fileman-mtp-"; |
| 45 const char kMtpVolumeIdPrefix [] = "mtp:"; | 47 const char kMtpVolumeIdPrefix [] = "mtp:"; |
| 46 const char kRootPath[] = "/"; | 48 const char kRootPath[] = "/"; |
| 47 | 49 |
| 48 // Registers |path| as the "Downloads" folder to the FileSystem API backend. | 50 // Registers |path| as the "Downloads" folder to the FileSystem API backend. |
| 49 // If another folder is already mounted. It revokes and overrides the old one. | 51 // If another folder is already mounted. It revokes and overrides the old one. |
| 50 bool RegisterDownloadsMountPoint(Profile* profile, const base::FilePath& path) { | 52 bool RegisterDownloadsMountPoint(Profile* profile, const base::FilePath& path) { |
| 51 // Although we show only profile's own "Downloads" folder in Files.app, | 53 // Although we show only profile's own "Downloads" folder in Files.app, |
| 52 // in the backend we need to mount all profile's download directory globally. | 54 // in the backend we need to mount all profile's download directory globally. |
| 53 // Otherwise, Files.app cannot support cross-profile file copies, etc. | 55 // Otherwise, Files.app cannot support cross-profile file copies, etc. |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 if (mounted_volumes_.find(volume->volume_id()) == mounted_volumes_.end()) | 875 if (mounted_volumes_.find(volume->volume_id()) == mounted_volumes_.end()) |
| 874 return; | 876 return; |
| 875 if (error_code == chromeos::MOUNT_ERROR_NONE) | 877 if (error_code == chromeos::MOUNT_ERROR_NONE) |
| 876 mounted_volumes_.erase(volume->volume_id()); | 878 mounted_volumes_.erase(volume->volume_id()); |
| 877 | 879 |
| 878 FOR_EACH_OBSERVER(VolumeManagerObserver, observers_, | 880 FOR_EACH_OBSERVER(VolumeManagerObserver, observers_, |
| 879 OnVolumeUnmounted(error_code, *volume.get())); | 881 OnVolumeUnmounted(error_code, *volume.get())); |
| 880 } | 882 } |
| 881 | 883 |
| 882 } // namespace file_manager | 884 } // namespace file_manager |
| OLD | NEW |