| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.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/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/app_mode/app_mode_utils.h" | 16 #include "chrome/browser/app_mode/app_mode_utils.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_change.h" |
| 19 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 19 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
| 20 #include "chrome/browser/chromeos/drive/file_system_util.h" | 20 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 21 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 21 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| 22 #include "chrome/browser/chromeos/file_manager/app_id.h" | 22 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 23 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 23 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 24 #include "chrome/browser/chromeos/file_manager/open_util.h" | 24 #include "chrome/browser/chromeos/file_manager/open_util.h" |
| 25 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 25 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 26 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 26 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 27 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 27 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 28 #include "chrome/browser/drive/drive_service_interface.h" | 28 #include "chrome/browser/drive/drive_service_interface.h" |
| 29 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | |
| 30 #include "chrome/browser/extensions/extension_service.h" | 29 #include "chrome/browser/extensions/extension_service.h" |
| 31 #include "chrome/browser/extensions/extension_util.h" | 30 #include "chrome/browser/extensions/extension_util.h" |
| 32 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| 33 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
| 34 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 36 #include "chromeos/dbus/dbus_thread_manager.h" | 35 #include "chromeos/dbus/dbus_thread_manager.h" |
| 37 #include "chromeos/login/login_state.h" | 36 #include "chromeos/login/login_state.h" |
| 38 #include "chromeos/network/network_handler.h" | 37 #include "chromeos/network/network_handler.h" |
| 39 #include "chromeos/network/network_state_handler.h" | 38 #include "chromeos/network/network_state_handler.h" |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 // profile_ is NULL if ShutdownOnUIThread() is called earlier. This can | 861 // profile_ is NULL if ShutdownOnUIThread() is called earlier. This can |
| 863 // happen at shutdown. This should be removed after removing Drive mounting | 862 // happen at shutdown. This should be removed after removing Drive mounting |
| 864 // code in addMount. (addMount -> OnFileSystemMounted -> OnVolumeMounted is | 863 // code in addMount. (addMount -> OnFileSystemMounted -> OnVolumeMounted is |
| 865 // the only path to come here after Shutdown is called). | 864 // the only path to come here after Shutdown is called). |
| 866 if (!profile_) | 865 if (!profile_) |
| 867 return; | 866 return; |
| 868 | 867 |
| 869 DispatchMountCompletedEvent( | 868 DispatchMountCompletedEvent( |
| 870 file_manager_private::MOUNT_COMPLETED_EVENT_TYPE_MOUNT, error_code, | 869 file_manager_private::MOUNT_COMPLETED_EVENT_TYPE_MOUNT, error_code, |
| 871 volume); | 870 volume); |
| 872 | |
| 873 // TODO(mtomasz): Move VolumeManager and part of the event router outside of | |
| 874 // file_manager, so there is no dependency between File System API and the | |
| 875 // file_manager code. | |
| 876 extensions::file_system_api::DispatchVolumeListChangeEvent(profile_); | |
| 877 } | 871 } |
| 878 | 872 |
| 879 void EventRouter::OnVolumeUnmounted(chromeos::MountError error_code, | 873 void EventRouter::OnVolumeUnmounted(chromeos::MountError error_code, |
| 880 const Volume& volume) { | 874 const Volume& volume) { |
| 881 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 875 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 882 DispatchMountCompletedEvent( | 876 DispatchMountCompletedEvent( |
| 883 file_manager_private::MOUNT_COMPLETED_EVENT_TYPE_UNMOUNT, error_code, | 877 file_manager_private::MOUNT_COMPLETED_EVENT_TYPE_UNMOUNT, error_code, |
| 884 volume); | 878 volume); |
| 885 } | 879 } |
| 886 | 880 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 915 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( | 909 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( |
| 916 const DispatchDirectoryChangeEventImplCallback& callback) { | 910 const DispatchDirectoryChangeEventImplCallback& callback) { |
| 917 dispatch_directory_change_event_impl_ = callback; | 911 dispatch_directory_change_event_impl_ = callback; |
| 918 } | 912 } |
| 919 | 913 |
| 920 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { | 914 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { |
| 921 return weak_factory_.GetWeakPtr(); | 915 return weak_factory_.GetWeakPtr(); |
| 922 } | 916 } |
| 923 | 917 |
| 924 } // namespace file_manager | 918 } // namespace file_manager |
| OLD | NEW |