OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/file_browser_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_event_router.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 // the screen is locked. | 699 // the screen is locked. |
700 if (chromeos::BaseLoginDisplayHost::default_host() || | 700 if (chromeos::BaseLoginDisplayHost::default_host() || |
701 chromeos::ScreenLocker::default_screen_locker()) | 701 chromeos::ScreenLocker::default_screen_locker()) |
702 return; | 702 return; |
703 | 703 |
704 // According to DCF (Design rule of Camera File system) by JEITA / CP-3461 | 704 // According to DCF (Design rule of Camera File system) by JEITA / CP-3461 |
705 // cameras should have pictures located in the DCIM root directory. | 705 // cameras should have pictures located in the DCIM root directory. |
706 const base::FilePath dcim_path = mount_path.Append( | 706 const base::FilePath dcim_path = mount_path.Append( |
707 FILE_PATH_LITERAL("DCIM")); | 707 FILE_PATH_LITERAL("DCIM")); |
708 | 708 |
709 // Show the action choice dialog only for sd cards with a DCIM directory. | 709 // Show the action choice dialog only for media with a DCIM directory. |
710 if (disk.device_type() == chromeos::DEVICE_TYPE_SD) { | 710 // Otherwise, just show Files.app. |
711 DirectoryExistsOnUIThread( | 711 DirectoryExistsOnUIThread( |
712 dcim_path, | 712 dcim_path, |
713 base::Bind(&file_manager_util::OpenActionChoiceDialog, mount_path), | 713 base::Bind(&file_manager_util::OpenActionChoiceDialog, mount_path), |
714 base::Bind(&file_manager_util::ViewRemovableDrive, mount_path)); | 714 base::Bind(&file_manager_util::ViewRemovableDrive, mount_path)); |
715 } else { | |
716 file_manager_util::ViewRemovableDrive(mount_path); | |
717 } | |
718 } | 715 } |
719 | 716 |
720 void FileBrowserEventRouter::OnDiskAdded( | 717 void FileBrowserEventRouter::OnDiskAdded( |
721 const DiskMountManager::Disk* disk) { | 718 const DiskMountManager::Disk* disk) { |
722 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 719 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
723 | 720 |
724 VLOG(1) << "Disk added: " << disk->device_path(); | 721 VLOG(1) << "Disk added: " << disk->device_path(); |
725 if (disk->device_path().empty()) { | 722 if (disk->device_path().empty()) { |
726 VLOG(1) << "Empty system path for " << disk->device_path(); | 723 VLOG(1) << "Empty system path for " << disk->device_path(); |
727 return; | 724 return; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 } | 909 } |
913 | 910 |
914 bool FileBrowserEventRouter::FileWatcherExtensions::Watch( | 911 bool FileBrowserEventRouter::FileWatcherExtensions::Watch( |
915 const base::FilePath& path, | 912 const base::FilePath& path, |
916 const base::FilePathWatcher::Callback& callback) { | 913 const base::FilePathWatcher::Callback& callback) { |
917 if (is_remote_file_system_) | 914 if (is_remote_file_system_) |
918 return true; | 915 return true; |
919 | 916 |
920 return file_watcher_->Watch(path, false, callback); | 917 return file_watcher_->Watch(path, false, callback); |
921 } | 918 } |
OLD | NEW |