Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: chrome/browser/chromeos/file_manager/volume_manager.cc

Issue 295943002: Multi-Profile in Files.app: always mount per-profile "Downloads" folder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revived the "first profile" check more sanely. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/file_manager/path_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 const base::FilePath old_path = 283 const base::FilePath old_path =
284 profile_->GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); 284 profile_->GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
285 base::FilePath new_path; 285 base::FilePath new_path;
286 if (!old_path.empty() && 286 if (!old_path.empty() &&
287 file_manager::util::MigratePathFromOldFormat(profile_, 287 file_manager::util::MigratePathFromOldFormat(profile_,
288 old_path, &new_path)) { 288 old_path, &new_path)) {
289 profile_->GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, 289 profile_->GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory,
290 new_path); 290 new_path);
291 } 291 }
292 292
293 static bool added_downloads = false; 293 // Register 'Downloads' folder for the profile to the file system.
294 if (base::SysInfo::IsRunningOnChromeOS() || !added_downloads) { 294 const base::FilePath downloads =
295 // Register 'Downloads' folder for the profile to the file system. 295 file_manager::util::GetDownloadsFolderForProfile(profile_);
296 // On non-ChromeOS system (test+development), we should do this only for 296 const bool success = RegisterDownloadsMountPoint(profile_, downloads);
297 // the first registered profile. 297 DCHECK(success);
298 const base::FilePath downloads =
299 file_manager::util::GetDownloadsFolderForProfile(profile_);
300 const bool success = RegisterDownloadsMountPoint(profile_, downloads);
301 added_downloads = success;
302 DCHECK(success);
303 298
304 DoMountEvent(chromeos::MOUNT_ERROR_NONE, 299 DoMountEvent(chromeos::MOUNT_ERROR_NONE,
305 CreateDownloadsVolumeInfo(downloads), 300 CreateDownloadsVolumeInfo(downloads),
306 kNotRemounting); 301 kNotRemounting);
307 }
308 302
309 // Subscribe to DriveIntegrationService. 303 // Subscribe to DriveIntegrationService.
310 if (drive_integration_service_) { 304 if (drive_integration_service_) {
311 drive_integration_service_->AddObserver(this); 305 drive_integration_service_->AddObserver(this);
312 if (drive_integration_service_->IsMounted()) { 306 if (drive_integration_service_->IsMounted()) {
313 DoMountEvent(chromeos::MOUNT_ERROR_NONE, 307 DoMountEvent(chromeos::MOUNT_ERROR_NONE,
314 CreateDriveVolumeInfo(profile_), 308 CreateDriveVolumeInfo(profile_),
315 kNotRemounting); 309 kNotRemounting);
316 } 310 }
317 } 311 }
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 return; 834 return;
841 if (error_code == chromeos::MOUNT_ERROR_NONE) 835 if (error_code == chromeos::MOUNT_ERROR_NONE)
842 mounted_volumes_.erase(volume_info.volume_id); 836 mounted_volumes_.erase(volume_info.volume_id);
843 837
844 FOR_EACH_OBSERVER(VolumeManagerObserver, 838 FOR_EACH_OBSERVER(VolumeManagerObserver,
845 observers_, 839 observers_,
846 OnVolumeUnmounted(error_code, volume_info)); 840 OnVolumeUnmounted(error_code, volume_info));
847 } 841 }
848 842
849 } // namespace file_manager 843 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/path_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698