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 "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "base/metrics/histogram.h" | |
14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 17 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
17 #include "chrome/browser/chromeos/drive/file_errors.h" | 18 #include "chrome/browser/chromeos/drive/file_errors.h" |
18 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 19 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
19 #include "chrome/browser/chromeos/drive/file_system_util.h" | 20 #include "chrome/browser/chromeos/drive/file_system_util.h" |
20 #include "chrome/browser/chromeos/file_manager/mounted_disk_monitor.h" | 21 #include "chrome/browser/chromeos/file_manager/mounted_disk_monitor.h" |
21 #include "chrome/browser/chromeos/file_manager/path_util.h" | 22 #include "chrome/browser/chromeos/file_manager/path_util.h" |
22 #include "chrome/browser/chromeos/file_manager/volume_manager_factory.h" | 23 #include "chrome/browser/chromeos/file_manager/volume_manager_factory.h" |
23 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" | 24 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
721 fileapi::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( | 722 fileapi::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( |
722 fsid, fileapi::kFileSystemTypeDeviceMediaAsFileStorage, | 723 fsid, fileapi::kFileSystemTypeDeviceMediaAsFileStorage, |
723 fileapi::FileSystemMountOption(), path); | 724 fileapi::FileSystemMountOption(), path); |
724 DCHECK(result); | 725 DCHECK(result); |
725 content::BrowserThread::PostTask( | 726 content::BrowserThread::PostTask( |
726 content::BrowserThread::IO, FROM_HERE, base::Bind( | 727 content::BrowserThread::IO, FROM_HERE, base::Bind( |
727 &MTPDeviceMapService::RegisterMTPFileSystem, | 728 &MTPDeviceMapService::RegisterMTPFileSystem, |
728 base::Unretained(MTPDeviceMapService::GetInstance()), | 729 base::Unretained(MTPDeviceMapService::GetInstance()), |
729 info.location(), fsid)); | 730 info.location(), fsid)); |
730 | 731 |
732 UMA_HISTOGRAM_COUNTS("FileBrowser.MTPMount", 1); | |
Ilya Sherman
2014/05/01 21:15:24
You're currently allocating space for 50 buckets,
kinaba
2014/05/08 04:15:41
Done.
| |
733 | |
731 VolumeInfo volume_info; | 734 VolumeInfo volume_info; |
732 volume_info.type = VOLUME_TYPE_MTP; | 735 volume_info.type = VOLUME_TYPE_MTP; |
733 volume_info.mount_path = path; | 736 volume_info.mount_path = path; |
734 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE; | 737 volume_info.mount_condition = chromeos::disks::MOUNT_CONDITION_NONE; |
735 volume_info.is_parent = true; | 738 volume_info.is_parent = true; |
736 volume_info.is_read_only = true; | 739 volume_info.is_read_only = true; |
737 volume_info.volume_id = "mtp:" + name; | 740 volume_info.volume_id = "mtp:" + name; |
738 volume_info.source_path = path; | 741 volume_info.source_path = path; |
739 volume_info.device_type = chromeos::DEVICE_TYPE_MOBILE; | 742 volume_info.device_type = chromeos::DEVICE_TYPE_MOBILE; |
740 DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info, false); | 743 DoMountEvent(chromeos::MOUNT_ERROR_NONE, volume_info, false); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
813 return; | 816 return; |
814 if (error_code == chromeos::MOUNT_ERROR_NONE) | 817 if (error_code == chromeos::MOUNT_ERROR_NONE) |
815 mounted_volumes_.erase(volume_info.volume_id); | 818 mounted_volumes_.erase(volume_info.volume_id); |
816 | 819 |
817 FOR_EACH_OBSERVER(VolumeManagerObserver, | 820 FOR_EACH_OBSERVER(VolumeManagerObserver, |
818 observers_, | 821 observers_, |
819 OnVolumeUnmounted(error_code, volume_info)); | 822 OnVolumeUnmounted(error_code, volume_info)); |
820 } | 823 } |
821 | 824 |
822 } // namespace file_manager | 825 } // namespace file_manager |
OLD | NEW |