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

Unified Diff: chrome/browser/chromeos/extensions/file_manager/event_router.cc

Issue 251593005: Files.app auto pop up for MTP storage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/file_manager/event_router.cc
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
index 83cbe971a5ead77c2aba97406fa5aac58d6954fa..0a04a2b2d47ee62485d708b55503b0bfa8e6fc61 100644
--- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
@@ -759,6 +759,7 @@ void EventRouter::DispatchDirectoryChangeEventWithEntryDefinition(
}
void EventRouter::ShowRemovableDeviceInFileManager(
+ VolumeType type,
const base::FilePath& mount_path) {
// Do not attempt to open File Manager while the login is in progress or
// the screen is locked or running in kiosk app mode and make sure the file
@@ -773,19 +774,24 @@ void EventRouter::ShowRemovableDeviceInFileManager(
if (IsRecoveryToolRunning(profile_))
return;
- // According to DCF (Design rule of Camera File system) by JEITA / CP-3461
- // cameras should have pictures located in the DCIM root directory.
- const base::FilePath dcim_path = mount_path.Append(
- FILE_PATH_LITERAL("DCIM"));
+ // Do not pop-up the File Manager, if Google+ Photos may be launched.
+ if (IsGooglePhotosInstalled(profile_)) {
+ // MTP device is handled by Photos app.
+ if (type == VOLUME_TYPE_MTP)
+ return;
+ // According to DCF (Design rule of Camera File system) by JEITA / CP-3461
+ // cameras should have pictures located in the DCIM root directory.
+ // Such removable disks are handled by Photos app.
+ if (type == VOLUME_TYPE_REMOVABLE_DISK_PARTITION) {
+ DirectoryExistsOnUIThread(
+ mount_path.AppendASCII("DCIM"),
+ base::Bind(&base::DoNothing),
+ base::Bind(&util::OpenRemovableDrive, profile_, mount_path));
+ return;
+ }
+ }
- // If there is a DCIM folder and Google+ Photos is installed, then do not
- // launch Files.app.
- DirectoryExistsOnUIThread(
- dcim_path,
- IsGooglePhotosInstalled(profile_)
- ? base::Bind(&base::DoNothing)
- : base::Bind(&util::OpenRemovableDrive, profile_, mount_path),
- base::Bind(&util::OpenRemovableDrive, profile_, mount_path));
+ util::OpenRemovableDrive(profile_, mount_path);
}
void EventRouter::DispatchDeviceEvent(
@@ -866,12 +872,14 @@ void EventRouter::OnVolumeMounted(chromeos::MountError error_code,
volume_info,
is_remounting);
- if (volume_info.type == VOLUME_TYPE_REMOVABLE_DISK_PARTITION &&
+ if ((volume_info.type == VOLUME_TYPE_MTP ||
+ volume_info.type == VOLUME_TYPE_REMOVABLE_DISK_PARTITION) &&
!is_remounting) {
// If a new device was mounted, a new File manager window may need to be
// opened.
if (error_code == chromeos::MOUNT_ERROR_NONE)
- ShowRemovableDeviceInFileManager(volume_info.mount_path);
+ ShowRemovableDeviceInFileManager(volume_info.type,
+ volume_info.mount_path);
}
}

Powered by Google App Engine
This is Rietveld 408576698