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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/event_router.cc

Issue 1135383002: Add the chrome.fileSystem.onVolumeListChanged event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up. Created 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/file_system/file_system_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
29 #include "chrome/browser/extensions/extension_service.h" 30 #include "chrome/browser/extensions/extension_service.h"
30 #include "chrome/browser/extensions/extension_util.h" 31 #include "chrome/browser/extensions/extension_util.h"
31 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/profiles/profile_manager.h" 33 #include "chrome/browser/profiles/profile_manager.h"
33 #include "chrome/common/chrome_switches.h" 34 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
35 #include "chromeos/dbus/dbus_thread_manager.h" 36 #include "chromeos/dbus/dbus_thread_manager.h"
36 #include "chromeos/login/login_state.h" 37 #include "chromeos/login/login_state.h"
37 #include "chromeos/network/network_handler.h" 38 #include "chromeos/network/network_handler.h"
38 #include "chromeos/network/network_state_handler.h" 39 #include "chromeos/network/network_state_handler.h"
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 // profile_ is NULL if ShutdownOnUIThread() is called earlier. This can 862 // profile_ is NULL if ShutdownOnUIThread() is called earlier. This can
862 // happen at shutdown. This should be removed after removing Drive mounting 863 // happen at shutdown. This should be removed after removing Drive mounting
863 // code in addMount. (addMount -> OnFileSystemMounted -> OnVolumeMounted is 864 // code in addMount. (addMount -> OnFileSystemMounted -> OnVolumeMounted is
864 // the only path to come here after Shutdown is called). 865 // the only path to come here after Shutdown is called).
865 if (!profile_) 866 if (!profile_)
866 return; 867 return;
867 868
868 DispatchMountCompletedEvent( 869 DispatchMountCompletedEvent(
869 file_manager_private::MOUNT_COMPLETED_EVENT_TYPE_MOUNT, error_code, 870 file_manager_private::MOUNT_COMPLETED_EVENT_TYPE_MOUNT, error_code,
870 volume); 871 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_);
871 } 877 }
872 878
873 void EventRouter::OnVolumeUnmounted(chromeos::MountError error_code, 879 void EventRouter::OnVolumeUnmounted(chromeos::MountError error_code,
874 const Volume& volume) { 880 const Volume& volume) {
875 DCHECK_CURRENTLY_ON(BrowserThread::UI); 881 DCHECK_CURRENTLY_ON(BrowserThread::UI);
876 DispatchMountCompletedEvent( 882 DispatchMountCompletedEvent(
877 file_manager_private::MOUNT_COMPLETED_EVENT_TYPE_UNMOUNT, error_code, 883 file_manager_private::MOUNT_COMPLETED_EVENT_TYPE_UNMOUNT, error_code,
878 volume); 884 volume);
879 } 885 }
880 886
(...skipping 28 matching lines...) Expand all
909 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting( 915 void EventRouter::SetDispatchDirectoryChangeEventImplForTesting(
910 const DispatchDirectoryChangeEventImplCallback& callback) { 916 const DispatchDirectoryChangeEventImplCallback& callback) {
911 dispatch_directory_change_event_impl_ = callback; 917 dispatch_directory_change_event_impl_ = callback;
912 } 918 }
913 919
914 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() { 920 base::WeakPtr<EventRouter> EventRouter::GetWeakPtr() {
915 return weak_factory_.GetWeakPtr(); 921 return weak_factory_.GetWeakPtr();
916 } 922 }
917 923
918 } // namespace file_manager 924 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/file_system/file_system_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698