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" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 const base::FilePath old_path = | 236 const base::FilePath old_path = |
237 profile_->GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); | 237 profile_->GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); |
238 base::FilePath new_path; | 238 base::FilePath new_path; |
239 if (!old_path.empty() && | 239 if (!old_path.empty() && |
240 file_manager::util::MigratePathFromOldFormat(profile_, | 240 file_manager::util::MigratePathFromOldFormat(profile_, |
241 old_path, &new_path)) { | 241 old_path, &new_path)) { |
242 profile_->GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, | 242 profile_->GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, |
243 new_path); | 243 new_path); |
244 } | 244 } |
245 | 245 |
| 246 // If in Sign in profile, then skip mounting and listening for mount events. |
| 247 if (chromeos::ProfileHelper::IsSigninProfile(profile_)) |
| 248 return; |
| 249 |
246 // Register 'Downloads' folder for the profile to the file system. | 250 // Register 'Downloads' folder for the profile to the file system. |
247 if (!chromeos::ProfileHelper::IsSigninProfile(profile_)) { | 251 const base::FilePath downloads = |
248 const base::FilePath downloads = | 252 file_manager::util::GetDownloadsFolderForProfile(profile_); |
249 file_manager::util::GetDownloadsFolderForProfile(profile_); | 253 const bool success = RegisterDownloadsMountPoint(profile_, downloads); |
250 const bool success = RegisterDownloadsMountPoint(profile_, downloads); | 254 DCHECK(success); |
251 DCHECK(success); | |
252 | 255 |
253 DoMountEvent(chromeos::MOUNT_ERROR_NONE, | 256 DoMountEvent(chromeos::MOUNT_ERROR_NONE, |
254 CreateDownloadsVolumeInfo(downloads), | 257 CreateDownloadsVolumeInfo(downloads), |
255 kNotRemounting); | 258 kNotRemounting); |
256 } | |
257 | 259 |
258 // Subscribe to DriveIntegrationService. | 260 // Subscribe to DriveIntegrationService. |
259 if (drive_integration_service_) { | 261 if (drive_integration_service_) { |
260 drive_integration_service_->AddObserver(this); | 262 drive_integration_service_->AddObserver(this); |
261 if (drive_integration_service_->IsMounted()) { | 263 if (drive_integration_service_->IsMounted()) { |
262 DoMountEvent(chromeos::MOUNT_ERROR_NONE, | 264 DoMountEvent(chromeos::MOUNT_ERROR_NONE, |
263 CreateDriveVolumeInfo(profile_), | 265 CreateDriveVolumeInfo(profile_), |
264 kNotRemounting); | 266 kNotRemounting); |
265 } | 267 } |
266 } | 268 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 return; | 648 return; |
647 if (error_code == chromeos::MOUNT_ERROR_NONE) | 649 if (error_code == chromeos::MOUNT_ERROR_NONE) |
648 mounted_volumes_.erase(volume_info.volume_id); | 650 mounted_volumes_.erase(volume_info.volume_id); |
649 | 651 |
650 FOR_EACH_OBSERVER(VolumeManagerObserver, | 652 FOR_EACH_OBSERVER(VolumeManagerObserver, |
651 observers_, | 653 observers_, |
652 OnVolumeUnmounted(error_code, volume_info)); | 654 OnVolumeUnmounted(error_code, volume_info)); |
653 } | 655 } |
654 | 656 |
655 } // namespace file_manager | 657 } // namespace file_manager |
OLD | NEW |