| 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 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/files/file_path_watcher.h" | 11 #include "base/files/file_path_watcher.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 13 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 14 #include "chrome/browser/chromeos/drive/file_system_observer.h" | 14 #include "chrome/browser/chromeos/drive/file_system_observer.h" |
| 15 #include "chrome/browser/chromeos/drive/job_list.h" | 15 #include "chrome/browser/chromeos/drive/job_list.h" |
| 16 #include "chrome/browser/chromeos/extensions/file_manager/file_watcher_extension
s.h" | 16 #include "chrome/browser/chromeos/extensions/file_manager/file_watcher.h" |
| 17 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" | 17 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" |
| 18 #include "chrome/browser/drive/drive_service_interface.h" | 18 #include "chrome/browser/drive/drive_service_interface.h" |
| 19 #include "chromeos/disks/disk_mount_manager.h" | 19 #include "chromeos/disks/disk_mount_manager.h" |
| 20 | 20 |
| 21 class PrefChangeRegistrar; | 21 class PrefChangeRegistrar; |
| 22 class Profile; | 22 class Profile; |
| 23 | 23 |
| 24 namespace file_manager { | 24 namespace file_manager { |
| 25 | 25 |
| 26 class DesktopNotifications; | 26 class DesktopNotifications; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // drive::FileSystemObserver overrides. | 93 // drive::FileSystemObserver overrides. |
| 94 virtual void OnDirectoryChanged( | 94 virtual void OnDirectoryChanged( |
| 95 const base::FilePath& directory_path) OVERRIDE; | 95 const base::FilePath& directory_path) OVERRIDE; |
| 96 | 96 |
| 97 // drive::DriveIntegrationServiceObserver overrides. | 97 // drive::DriveIntegrationServiceObserver overrides. |
| 98 virtual void OnFileSystemMounted() OVERRIDE; | 98 virtual void OnFileSystemMounted() OVERRIDE; |
| 99 virtual void OnFileSystemBeingUnmounted() OVERRIDE; | 99 virtual void OnFileSystemBeingUnmounted() OVERRIDE; |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 typedef std::map<base::FilePath, FileWatcherExtensions*> WatcherMap; | 102 typedef std::map<base::FilePath, FileWatcher*> WatcherMap; |
| 103 | 103 |
| 104 // USB mount event handlers. | 104 // USB mount event handlers. |
| 105 void OnDiskAdded(const chromeos::disks::DiskMountManager::Disk* disk); | 105 void OnDiskAdded(const chromeos::disks::DiskMountManager::Disk* disk); |
| 106 void OnDiskRemoved(const chromeos::disks::DiskMountManager::Disk* disk); | 106 void OnDiskRemoved(const chromeos::disks::DiskMountManager::Disk* disk); |
| 107 void OnDiskMounted(const chromeos::disks::DiskMountManager::Disk* disk); | 107 void OnDiskMounted(const chromeos::disks::DiskMountManager::Disk* disk); |
| 108 void OnDiskUnmounted(const chromeos::disks::DiskMountManager::Disk* disk); | 108 void OnDiskUnmounted(const chromeos::disks::DiskMountManager::Disk* disk); |
| 109 void OnDeviceAdded(const std::string& device_path); | 109 void OnDeviceAdded(const std::string& device_path); |
| 110 void OnDeviceRemoved(const std::string& device_path); | 110 void OnDeviceRemoved(const std::string& device_path); |
| 111 void OnDeviceScanned(const std::string& device_path); | 111 void OnDeviceScanned(const std::string& device_path); |
| 112 void OnFormatStarted(const std::string& device_path, bool success); | 112 void OnFormatStarted(const std::string& device_path, bool success); |
| 113 void OnFormatCompleted(const std::string& device_path, bool success); | 113 void OnFormatCompleted(const std::string& device_path, bool success); |
| 114 | 114 |
| 115 // Called on change to kExternalStorageDisabled pref. | 115 // Called on change to kExternalStorageDisabled pref. |
| 116 void OnExternalStorageDisabledChanged(); | 116 void OnExternalStorageDisabledChanged(); |
| 117 | 117 |
| 118 // Called when prefs related to file manager change. | 118 // Called when prefs related to file manager change. |
| 119 void OnFileManagerPrefsChanged(); | 119 void OnFileManagerPrefsChanged(); |
| 120 | 120 |
| 121 // Process file watch notifications. | 121 // Process file watch notifications. |
| 122 void HandleFileWatchNotification(const base::FilePath& path, | 122 void HandleFileWatchNotification(const base::FilePath& path, |
| 123 bool got_error); | 123 bool got_error); |
| 124 | 124 |
| 125 // Sends directory change event. | 125 // Sends directory change event. |
| 126 void DispatchDirectoryChangeEvent( | 126 void DispatchDirectoryChangeEvent( |
| 127 const base::FilePath& path, | 127 const base::FilePath& path, |
| 128 bool error, | 128 bool error, |
| 129 const FileWatcherExtensions::ExtensionUsageRegistry& extensions); | 129 const FileWatcher::ExtensionUsageRegistry& extensions); |
| 130 | 130 |
| 131 void DispatchMountEvent( | 131 void DispatchMountEvent( |
| 132 chromeos::disks::DiskMountManager::MountEvent event, | 132 chromeos::disks::DiskMountManager::MountEvent event, |
| 133 chromeos::MountError error_code, | 133 chromeos::MountError error_code, |
| 134 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info); | 134 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info); |
| 135 | 135 |
| 136 // If needed, opens a file manager window for the removable device mounted at | 136 // If needed, opens a file manager window for the removable device mounted at |
| 137 // |mount_path|. Disk.mount_path() is empty, since it is being filled out | 137 // |mount_path|. Disk.mount_path() is empty, since it is being filled out |
| 138 // after calling notifying observers by DiskMountManager. | 138 // after calling notifying observers by DiskMountManager. |
| 139 void ShowRemovableDeviceInFileManager( | 139 void ShowRemovableDeviceInFileManager( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 165 | 165 |
| 166 // Note: This should remain the last member so it'll be destroyed and | 166 // Note: This should remain the last member so it'll be destroyed and |
| 167 // invalidate the weak pointers before any other members are destroyed. | 167 // invalidate the weak pointers before any other members are destroyed. |
| 168 base::WeakPtrFactory<EventRouter> weak_factory_; | 168 base::WeakPtrFactory<EventRouter> weak_factory_; |
| 169 DISALLOW_COPY_AND_ASSIGN(EventRouter); | 169 DISALLOW_COPY_AND_ASSIGN(EventRouter); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace file_manager | 172 } // namespace file_manager |
| 173 | 173 |
| 174 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 174 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| OLD | NEW |