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_manager/event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "chrome/browser/app_mode/app_mode_utils.h" | 15 #include "chrome/browser/app_mode/app_mode_utils.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 17 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 18 #include "chrome/browser/chromeos/drive/file_change.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/extensions/file_manager/private_api_util.h" | 21 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
21 #include "chrome/browser/chromeos/file_manager/app_id.h" | 22 #include "chrome/browser/chromeos/file_manager/app_id.h" |
22 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 23 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
23 #include "chrome/browser/chromeos/file_manager/open_util.h" | 24 #include "chrome/browser/chromeos/file_manager/open_util.h" |
24 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 25 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
25 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 26 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
26 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 27 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
27 #include "chrome/browser/drive/drive_service_interface.h" | 28 #include "chrome/browser/drive/drive_service_interface.h" |
28 #include "chrome/browser/extensions/extension_service.h" | 29 #include "chrome/browser/extensions/extension_service.h" |
| 30 #include "chrome/browser/extensions/extension_util.h" |
29 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
33 #include "chromeos/login/login_state.h" | 35 #include "chromeos/login/login_state.h" |
34 #include "chromeos/network/network_handler.h" | 36 #include "chromeos/network/network_handler.h" |
35 #include "chromeos/network/network_state_handler.h" | 37 #include "chromeos/network/network_state_handler.h" |
36 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
37 #include "content/public/browser/notification_source.h" | 39 #include "content/public/browser/notification_source.h" |
38 #include "content/public/browser/render_process_host.h" | 40 #include "content/public/browser/render_process_host.h" |
| 41 #include "content/public/browser/storage_partition.h" |
39 #include "extensions/browser/event_router.h" | 42 #include "extensions/browser/event_router.h" |
40 #include "extensions/browser/extension_host.h" | 43 #include "extensions/browser/extension_host.h" |
41 #include "extensions/browser/extension_prefs.h" | 44 #include "extensions/browser/extension_prefs.h" |
42 #include "extensions/browser/extension_system.h" | 45 #include "extensions/browser/extension_system.h" |
43 #include "webkit/common/fileapi/file_system_types.h" | 46 #include "webkit/common/fileapi/file_system_types.h" |
44 #include "webkit/common/fileapi/file_system_util.h" | 47 #include "webkit/common/fileapi/file_system_util.h" |
45 | 48 |
46 using chromeos::disks::DiskMountManager; | 49 using chromeos::disks::DiskMountManager; |
47 using chromeos::NetworkHandler; | 50 using chromeos::NetworkHandler; |
48 using content::BrowserThread; | 51 using content::BrowserThread; |
49 using drive::DriveIntegrationService; | 52 using drive::DriveIntegrationService; |
50 using drive::DriveIntegrationServiceFactory; | 53 using drive::DriveIntegrationServiceFactory; |
51 using file_manager::util::EntryDefinition; | 54 using file_manager::util::EntryDefinition; |
52 using file_manager::util::FileDefinition; | 55 using file_manager::util::FileDefinition; |
53 | 56 |
54 namespace file_browser_private = extensions::api::file_browser_private; | 57 namespace file_browser_private = extensions::api::file_browser_private; |
55 | 58 |
56 namespace file_manager { | 59 namespace file_manager { |
57 namespace { | 60 namespace { |
58 // Constants for the "transferState" field of onFileTransferUpdated event. | 61 // Constants for the "transferState" field of onFileTransferUpdated event. |
59 const char kFileTransferStateStarted[] = "started"; | 62 const char kFileTransferStateStarted[] = "started"; |
60 const char kFileTransferStateInProgress[] = "in_progress"; | 63 const char kFileTransferStateInProgress[] = "in_progress"; |
61 const char kFileTransferStateCompleted[] = "completed"; | 64 const char kFileTransferStateCompleted[] = "completed"; |
62 const char kFileTransferStateFailed[] = "failed"; | 65 const char kFileTransferStateFailed[] = "failed"; |
63 | 66 |
64 // Frequency of sending onFileTransferUpdated. | 67 // Frequency of sending onFileTransferUpdated. |
65 const int64 kProgressEventFrequencyInMilliseconds = 1000; | 68 const int64 kProgressEventFrequencyInMilliseconds = 1000; |
66 | 69 |
| 70 // Maximim size of detailed change info on directory change event. If the size |
| 71 // exceeds the maximum size, the detailed info is omitted and the force refresh |
| 72 // is kicked. |
| 73 const size_t kDirectoryChangeEventMaxDetailInfoSize = 1000; |
| 74 |
67 // Utility function to check if |job_info| is a file uploading job. | 75 // Utility function to check if |job_info| is a file uploading job. |
68 bool IsUploadJob(drive::JobType type) { | 76 bool IsUploadJob(drive::JobType type) { |
69 return (type == drive::TYPE_UPLOAD_NEW_FILE || | 77 return (type == drive::TYPE_UPLOAD_NEW_FILE || |
70 type == drive::TYPE_UPLOAD_EXISTING_FILE); | 78 type == drive::TYPE_UPLOAD_EXISTING_FILE); |
71 } | 79 } |
72 | 80 |
73 // Converts the job info to a IDL generated type. | 81 // Converts the job info to a IDL generated type. |
74 void JobInfoToTransferStatus( | 82 void JobInfoToTransferStatus( |
75 Profile* profile, | 83 Profile* profile, |
76 const std::string& extension_id, | 84 const std::string& extension_id, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_BEGIN_COPY_ENTRY; | 201 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_BEGIN_COPY_ENTRY; |
194 case fileapi::FileSystemOperation::END_COPY_ENTRY: | 202 case fileapi::FileSystemOperation::END_COPY_ENTRY: |
195 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_END_COPY_ENTRY; | 203 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_END_COPY_ENTRY; |
196 case fileapi::FileSystemOperation::PROGRESS: | 204 case fileapi::FileSystemOperation::PROGRESS: |
197 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_PROGRESS; | 205 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_PROGRESS; |
198 } | 206 } |
199 NOTREACHED(); | 207 NOTREACHED(); |
200 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_NONE; | 208 return file_browser_private::COPY_PROGRESS_STATUS_TYPE_NONE; |
201 } | 209 } |
202 | 210 |
| 211 file_browser_private::ChangeType ConvertChangeTypeFromDriveToApi( |
| 212 drive::FileChange::ChangeType type) { |
| 213 switch (type) { |
| 214 case drive::FileChange::ADD_OR_UPDATE: |
| 215 return file_browser_private::CHANGE_TYPE_ADD_OR_UPDATE; |
| 216 case drive::FileChange::DELETE: |
| 217 return file_browser_private::CHANGE_TYPE_DELETE; |
| 218 } |
| 219 NOTREACHED(); |
| 220 return file_browser_private::CHANGE_TYPE_ADD_OR_UPDATE; |
| 221 } |
| 222 |
203 std::string FileErrorToErrorName(base::File::Error error_code) { | 223 std::string FileErrorToErrorName(base::File::Error error_code) { |
204 namespace js = extensions::api::file_browser_private; | 224 namespace js = extensions::api::file_browser_private; |
205 switch (error_code) { | 225 switch (error_code) { |
206 case base::File::FILE_ERROR_NOT_FOUND: | 226 case base::File::FILE_ERROR_NOT_FOUND: |
207 return "NotFoundError"; | 227 return "NotFoundError"; |
208 case base::File::FILE_ERROR_INVALID_OPERATION: | 228 case base::File::FILE_ERROR_INVALID_OPERATION: |
209 case base::File::FILE_ERROR_EXISTS: | 229 case base::File::FILE_ERROR_EXISTS: |
210 case base::File::FILE_ERROR_NOT_EMPTY: | 230 case base::File::FILE_ERROR_NOT_EMPTY: |
211 return "InvalidModificationError"; | 231 return "InvalidModificationError"; |
212 case base::File::FILE_ERROR_NOT_A_DIRECTORY: | 232 case base::File::FILE_ERROR_NOT_A_DIRECTORY: |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 461 |
442 if (is_on_drive) { | 462 if (is_on_drive) { |
443 // For Drive, file watching is done via OnDirectoryChanged(). | 463 // For Drive, file watching is done via OnDirectoryChanged(). |
444 base::MessageLoopProxy::current()->PostTask(FROM_HERE, | 464 base::MessageLoopProxy::current()->PostTask(FROM_HERE, |
445 base::Bind(callback, true)); | 465 base::Bind(callback, true)); |
446 } else { | 466 } else { |
447 // For local files, start watching using FileWatcher. | 467 // For local files, start watching using FileWatcher. |
448 watcher->WatchLocalFile( | 468 watcher->WatchLocalFile( |
449 watch_path, | 469 watch_path, |
450 base::Bind(&EventRouter::HandleFileWatchNotification, | 470 base::Bind(&EventRouter::HandleFileWatchNotification, |
451 weak_factory_.GetWeakPtr()), | 471 weak_factory_.GetWeakPtr(), |
| 472 static_cast<drive::FileChange*>(NULL)), |
452 callback); | 473 callback); |
453 } | 474 } |
454 | 475 |
455 file_watchers_[watch_path] = watcher.release(); | 476 file_watchers_[watch_path] = watcher.release(); |
456 } else { | 477 } else { |
457 iter->second->AddExtension(extension_id); | 478 iter->second->AddExtension(extension_id); |
458 base::MessageLoopProxy::current()->PostTask(FROM_HERE, | 479 base::MessageLoopProxy::current()->PostTask(FROM_HERE, |
459 base::Bind(callback, true)); | 480 base::Bind(callback, true)); |
460 } | 481 } |
461 } | 482 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 status.get()); | 644 status.get()); |
624 status_list.push_back(status); | 645 status_list.push_back(status); |
625 } | 646 } |
626 BroadcastEvent( | 647 BroadcastEvent( |
627 profile_, | 648 profile_, |
628 file_browser_private::OnFileTransfersUpdated::kEventName, | 649 file_browser_private::OnFileTransfersUpdated::kEventName, |
629 file_browser_private::OnFileTransfersUpdated::Create(status_list)); | 650 file_browser_private::OnFileTransfersUpdated::Create(status_list)); |
630 } | 651 } |
631 | 652 |
632 void EventRouter::OnDirectoryChanged(const base::FilePath& drive_path) { | 653 void EventRouter::OnDirectoryChanged(const base::FilePath& drive_path) { |
633 HandleFileWatchNotification(drive_path, false); | 654 HandleFileWatchNotification(NULL, drive_path, false); |
| 655 } |
| 656 |
| 657 void EventRouter::OnFileChanged(const drive::FileChange& changed_files) { |
| 658 typedef std::map<base::FilePath, drive::FileChange> FileChangeMap; |
| 659 |
| 660 FileChangeMap map; |
| 661 const drive::FileChange::Map& changed_file_map = changed_files.map(); |
| 662 for (drive::FileChange::Map::const_iterator it = changed_file_map.begin(); |
| 663 it != changed_file_map.end(); |
| 664 it++) { |
| 665 const base::FilePath& path = it->first; |
| 666 map[path.DirName()].Update(path, it->second); |
| 667 } |
| 668 |
| 669 for (FileChangeMap::const_iterator it = map.begin(); it != map.end(); it++) { |
| 670 HandleFileWatchNotification(&(it->second), it->first, false); |
| 671 } |
634 } | 672 } |
635 | 673 |
636 void EventRouter::OnDriveSyncError(drive::file_system::DriveSyncErrorType type, | 674 void EventRouter::OnDriveSyncError(drive::file_system::DriveSyncErrorType type, |
637 const base::FilePath& drive_path) { | 675 const base::FilePath& drive_path) { |
638 file_browser_private::DriveSyncErrorEvent event; | 676 file_browser_private::DriveSyncErrorEvent event; |
639 switch (type) { | 677 switch (type) { |
640 case drive::file_system::DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION: | 678 case drive::file_system::DRIVE_SYNC_ERROR_DELETE_WITHOUT_PERMISSION: |
641 event.type = | 679 event.type = |
642 file_browser_private::DRIVE_SYNC_ERROR_TYPE_DELETE_WITHOUT_PERMISSION; | 680 file_browser_private::DRIVE_SYNC_ERROR_TYPE_DELETE_WITHOUT_PERMISSION; |
643 break; | 681 break; |
(...skipping 17 matching lines...) Expand all Loading... |
661 void EventRouter::OnRefreshTokenInvalid() { | 699 void EventRouter::OnRefreshTokenInvalid() { |
662 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 700 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
663 | 701 |
664 // Raise a DriveConnectionStatusChanged event to notify the status offline. | 702 // Raise a DriveConnectionStatusChanged event to notify the status offline. |
665 BroadcastEvent( | 703 BroadcastEvent( |
666 profile_, | 704 profile_, |
667 file_browser_private::OnDriveConnectionStatusChanged::kEventName, | 705 file_browser_private::OnDriveConnectionStatusChanged::kEventName, |
668 file_browser_private::OnDriveConnectionStatusChanged::Create()); | 706 file_browser_private::OnDriveConnectionStatusChanged::Create()); |
669 } | 707 } |
670 | 708 |
671 void EventRouter::HandleFileWatchNotification(const base::FilePath& local_path, | 709 void EventRouter::HandleFileWatchNotification(const drive::FileChange* list, |
| 710 const base::FilePath& local_path, |
672 bool got_error) { | 711 bool got_error) { |
673 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 712 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
674 | 713 |
675 WatcherMap::const_iterator iter = file_watchers_.find(local_path); | 714 WatcherMap::const_iterator iter = file_watchers_.find(local_path); |
676 if (iter == file_watchers_.end()) { | 715 if (iter == file_watchers_.end()) { |
677 return; | 716 return; |
678 } | 717 } |
679 DispatchDirectoryChangeEvent(iter->second->virtual_path(), got_error, | 718 |
| 719 if (list && list->size() > kDirectoryChangeEventMaxDetailInfoSize) { |
| 720 // Removes the detailed information, if the list size is more than |
| 721 // kDirectoryChangeEventMaxDetailInfoSize, since passing large list |
| 722 // and processing it may cause more itme. |
| 723 // This will be invoked full-refresh in Files.app. |
| 724 list = NULL; |
| 725 } |
| 726 |
| 727 DispatchDirectoryChangeEvent(iter->second->virtual_path(), |
| 728 list, |
| 729 got_error, |
680 iter->second->GetExtensionIds()); | 730 iter->second->GetExtensionIds()); |
681 } | 731 } |
682 | 732 |
683 void EventRouter::DispatchDirectoryChangeEvent( | 733 void EventRouter::DispatchDirectoryChangeEvent( |
684 const base::FilePath& virtual_path, | 734 const base::FilePath& virtual_path, |
| 735 const drive::FileChange* list, |
685 bool got_error, | 736 bool got_error, |
686 const std::vector<std::string>& extension_ids) { | 737 const std::vector<std::string>& extension_ids) { |
687 if (!profile_) { | 738 if (!profile_) { |
688 NOTREACHED(); | 739 NOTREACHED(); |
689 return; | 740 return; |
690 } | 741 } |
| 742 linked_ptr<drive::FileChange> changes; |
| 743 if (list) |
| 744 changes.reset(new drive::FileChange(*list)); // Copy |
691 | 745 |
692 for (size_t i = 0; i < extension_ids.size(); ++i) { | 746 for (size_t i = 0; i < extension_ids.size(); ++i) { |
693 const std::string& extension_id = extension_ids[i]; | 747 std::string* extension_id = new std::string(extension_ids[i]); |
694 | 748 |
695 FileDefinition file_definition; | 749 FileDefinition file_definition; |
696 file_definition.virtual_path = virtual_path; | 750 file_definition.virtual_path = virtual_path; |
697 file_definition.is_directory = true; | 751 file_definition.is_directory = true; |
698 | 752 |
699 file_manager::util::ConvertFileDefinitionToEntryDefinition( | 753 file_manager::util::ConvertFileDefinitionToEntryDefinition( |
700 profile_, | 754 profile_, |
701 extension_id, | 755 *extension_id, |
702 file_definition, | 756 file_definition, |
703 base::Bind( | 757 base::Bind( |
704 &EventRouter::DispatchDirectoryChangeEventWithEntryDefinition, | 758 &EventRouter::DispatchDirectoryChangeEventWithEntryDefinition, |
705 weak_factory_.GetWeakPtr(), | 759 weak_factory_.GetWeakPtr(), |
| 760 changes, |
| 761 base::Owned(extension_id), |
706 got_error)); | 762 got_error)); |
707 } | 763 } |
708 } | 764 } |
709 | 765 |
710 void EventRouter::DispatchDirectoryChangeEventWithEntryDefinition( | 766 void EventRouter::DispatchDirectoryChangeEventWithEntryDefinition( |
| 767 const linked_ptr<drive::FileChange> list, |
| 768 const std::string* extension_id, |
711 bool watcher_error, | 769 bool watcher_error, |
712 const EntryDefinition& entry_definition) { | 770 const EntryDefinition& entry_definition) { |
| 771 typedef std::map<base::FilePath, drive::FileChange::ChangeList> ChangeListMap; |
| 772 |
713 if (entry_definition.error != base::File::FILE_OK || | 773 if (entry_definition.error != base::File::FILE_OK || |
714 !entry_definition.is_directory) { | 774 !entry_definition.is_directory) { |
715 DVLOG(1) << "Unable to dispatch event because resolving the directory " | 775 DVLOG(1) << "Unable to dispatch event because resolving the directory " |
716 << "entry definition failed."; | 776 << "entry definition failed."; |
717 return; | 777 return; |
718 } | 778 } |
719 | 779 |
720 file_browser_private::FileWatchEvent event; | 780 file_browser_private::FileWatchEvent event; |
721 event.event_type = watcher_error | 781 event.event_type = watcher_error |
722 ? file_browser_private::FILE_WATCH_EVENT_TYPE_ERROR | 782 ? file_browser_private::FILE_WATCH_EVENT_TYPE_ERROR |
723 : file_browser_private::FILE_WATCH_EVENT_TYPE_CHANGED; | 783 : file_browser_private::FILE_WATCH_EVENT_TYPE_CHANGED; |
724 | 784 |
| 785 // Detailed information is available. |
| 786 if (list.get()) { |
| 787 event.changed_files.reset( |
| 788 new std::vector<linked_ptr<file_browser_private::FileChange> >); |
| 789 |
| 790 if (list->map().empty()) |
| 791 return; |
| 792 |
| 793 for (drive::FileChange::Map::const_iterator it = list->map().begin(); |
| 794 it != list->map().end(); |
| 795 it++) { |
| 796 linked_ptr<file_browser_private::FileChange> change_list( |
| 797 new file_browser_private::FileChange); |
| 798 |
| 799 GURL url = util::ConvertDrivePathToFileSystemUrl( |
| 800 profile_, it->first, *extension_id); |
| 801 change_list->url = url.spec(); |
| 802 |
| 803 for (drive::FileChange::ChangeList::List::const_iterator change = |
| 804 it->second.list().begin(); |
| 805 change != it->second.list().end(); |
| 806 change++) { |
| 807 change_list->changes.push_back( |
| 808 ConvertChangeTypeFromDriveToApi(change->change())); |
| 809 } |
| 810 |
| 811 event.changed_files->push_back(change_list); |
| 812 } |
| 813 } |
| 814 |
725 event.entry.additional_properties.SetString( | 815 event.entry.additional_properties.SetString( |
726 "fileSystemName", entry_definition.file_system_name); | 816 "fileSystemName", entry_definition.file_system_name); |
727 event.entry.additional_properties.SetString( | 817 event.entry.additional_properties.SetString( |
728 "fileSystemRoot", entry_definition.file_system_root_url); | 818 "fileSystemRoot", entry_definition.file_system_root_url); |
729 event.entry.additional_properties.SetString( | 819 event.entry.additional_properties.SetString( |
730 "fileFullPath", "/" + entry_definition.full_path.value()); | 820 "fileFullPath", "/" + entry_definition.full_path.value()); |
731 event.entry.additional_properties.SetBoolean("fileIsDirectory", | 821 event.entry.additional_properties.SetBoolean("fileIsDirectory", |
732 entry_definition.is_directory); | 822 entry_definition.is_directory); |
733 | 823 |
734 BroadcastEvent(profile_, | 824 BroadcastEvent(profile_, |
735 file_browser_private::OnDirectoryChanged::kEventName, | 825 file_browser_private::OnDirectoryChanged::kEventName, |
736 file_browser_private::OnDirectoryChanged::Create(event)); | 826 file_browser_private::OnDirectoryChanged::Create(event)); |
737 } | 827 } |
738 | 828 |
739 void EventRouter::DispatchDeviceEvent( | 829 void EventRouter::DispatchDeviceEvent( |
740 file_browser_private::DeviceEventType type, | 830 file_browser_private::DeviceEventType type, |
741 const std::string& device_path) { | 831 const std::string& device_path) { |
742 file_browser_private::DeviceEvent event; | 832 file_browser_private::DeviceEvent event; |
| 833 |
743 event.type = type; | 834 event.type = type; |
744 event.device_path = device_path; | 835 event.device_path = device_path; |
745 BroadcastEvent(profile_, | 836 BroadcastEvent(profile_, |
746 file_browser_private::OnDeviceChanged::kEventName, | 837 file_browser_private::OnDeviceChanged::kEventName, |
747 file_browser_private::OnDeviceChanged::Create(event)); | 838 file_browser_private::OnDeviceChanged::Create(event)); |
748 } | 839 } |
749 | 840 |
750 void EventRouter::OnDiskAdded( | 841 void EventRouter::OnDiskAdded( |
751 const DiskMountManager::Disk& disk, bool mounting) { | 842 const DiskMountManager::Disk& disk, bool mounting) { |
752 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 843 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 } | 980 } |
890 } | 981 } |
891 | 982 |
892 void EventRouter::OnOwnerEntryChanged(aura::Window* window) { | 983 void EventRouter::OnOwnerEntryChanged(aura::Window* window) { |
893 BroadcastEvent(profile_, | 984 BroadcastEvent(profile_, |
894 file_browser_private::OnDesktopChanged::kEventName, | 985 file_browser_private::OnDesktopChanged::kEventName, |
895 file_browser_private::OnDesktopChanged::Create()); | 986 file_browser_private::OnDesktopChanged::Create()); |
896 } | 987 } |
897 | 988 |
898 } // namespace file_manager | 989 } // namespace file_manager |
OLD | NEW |