| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 const FilePath& virtual_path, | 44 const FilePath& virtual_path, |
| 45 const std::string& extension_id); | 45 const std::string& extension_id); |
| 46 void RemoveFileWatch(const FilePath& file_path, | 46 void RemoveFileWatch(const FilePath& file_path, |
| 47 const std::string& extension_id); | 47 const std::string& extension_id); |
| 48 | 48 |
| 49 // MountLibrary::Observer overrides. | 49 // MountLibrary::Observer overrides. |
| 50 virtual void DiskChanged(chromeos::MountLibraryEventType event, | 50 virtual void DiskChanged(chromeos::MountLibraryEventType event, |
| 51 const chromeos::MountLibrary::Disk* disk) OVERRIDE; | 51 const chromeos::MountLibrary::Disk* disk) OVERRIDE; |
| 52 virtual void DeviceChanged(chromeos::MountLibraryEventType event, | 52 virtual void DeviceChanged(chromeos::MountLibraryEventType event, |
| 53 const std::string& device_path) OVERRIDE; | 53 const std::string& device_path) OVERRIDE; |
| 54 | |
| 55 virtual void MountCompleted(chromeos::MountLibrary::MountEvent event_type, | 54 virtual void MountCompleted(chromeos::MountLibrary::MountEvent event_type, |
| 56 chromeos::MountError error_code, | 55 chromeos::MountError error_code, |
| 57 const chromeos::MountLibrary::MountPointInfo& mount_info) OVERRIDE; | 56 const chromeos::MountLibrary::MountPointInfo& mount_info) OVERRIDE; |
| 58 | 57 |
| 59 private: | 58 private: |
| 60 typedef std::map<std::string, linked_ptr<chromeos::SystemNotification> > | 59 typedef std::map<std::string, linked_ptr<chromeos::SystemNotification> > |
| 61 NotificationMap; | 60 NotificationMap; |
| 62 typedef std::map<std::string, std::string> MountPointMap; | 61 typedef std::map<std::string, std::string> MountPointMap; |
| 63 typedef struct FileWatcherExtensions { | 62 typedef struct FileWatcherExtensions { |
| 64 FileWatcherExtensions(const FilePath& path, | 63 FileWatcherExtensions(const FilePath& path, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 86 virtual void OnFilePathError(const FilePath& path) OVERRIDE; | 85 virtual void OnFilePathError(const FilePath& path) OVERRIDE; |
| 87 | 86 |
| 88 void HandleFileWatchOnUIThread(const FilePath& local_path, bool got_error); | 87 void HandleFileWatchOnUIThread(const FilePath& local_path, bool got_error); |
| 89 | 88 |
| 90 ExtensionFileBrowserEventRouter* router_; | 89 ExtensionFileBrowserEventRouter* router_; |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 // USB mount event handlers. | 92 // USB mount event handlers. |
| 94 void OnDiskAdded(const chromeos::MountLibrary::Disk* disk); | 93 void OnDiskAdded(const chromeos::MountLibrary::Disk* disk); |
| 95 void OnDiskRemoved(const chromeos::MountLibrary::Disk* disk); | 94 void OnDiskRemoved(const chromeos::MountLibrary::Disk* disk); |
| 96 void OnDiskChanged(const chromeos::MountLibrary::Disk* disk); | |
| 97 void OnDiskMounted(const chromeos::MountLibrary::Disk* disk); | |
| 98 void OnDiskUnmounted(const chromeos::MountLibrary::Disk* disk); | |
| 99 void OnDeviceAdded(const std::string& device_path); | 95 void OnDeviceAdded(const std::string& device_path); |
| 100 void OnDeviceRemoved(const std::string& device_path); | 96 void OnDeviceRemoved(const std::string& device_path); |
| 101 void OnDeviceScanned(const std::string& device_path); | 97 void OnDeviceScanned(const std::string& device_path); |
| 102 void OnFormattingStarted(const std::string& device_path); | 98 void OnFormattingStarted(const std::string& device_path); |
| 103 void OnFormattingFinished(const std::string& device_path); | 99 void OnFormattingFinished(const std::string& device_path); |
| 104 | 100 |
| 105 // Finds first notifications corresponding to the same device. Ensures that | 101 // Finds first notifications corresponding to the same device. Ensures that |
| 106 // we don't pop up multiple notifications for the same device. | 102 // we don't pop up multiple notifications for the same device. |
| 107 NotificationMap::iterator FindNotificationForId(const std::string& path); | 103 NotificationMap::iterator FindNotificationForId(const std::string& path); |
| 108 | 104 |
| 109 // Process file watch notifications. | 105 // Process file watch notifications. |
| 110 void HandleFileWatchNotification(const FilePath& path, | 106 void HandleFileWatchNotification(const FilePath& path, |
| 111 bool got_error); | 107 bool got_error); |
| 112 | 108 |
| 113 // Sends folder change event. | 109 // Sends folder change event. |
| 114 void DispatchFolderChangeEvent(const FilePath& path, bool error, | 110 void DispatchFolderChangeEvent(const FilePath& path, bool error, |
| 115 const std::set<std::string>& extensions); | 111 const std::set<std::string>& extensions); |
| 116 | 112 |
| 117 // Sends filesystem changed extension message to all renderers. | 113 // Sends filesystem changed extension message to all renderers. |
| 118 void DispatchMountEvent(const chromeos::MountLibrary::Disk* disk, bool added); | 114 void DispatchDiskEvent(const chromeos::MountLibrary::Disk* disk, bool added); |
| 119 | 115 |
| 120 void DispatchMountCompletedEvent(chromeos::MountLibrary::MountEvent event, | 116 void DispatchMountCompletedEvent(chromeos::MountLibrary::MountEvent event, |
| 121 chromeos::MountError error_code, | 117 chromeos::MountError error_code, |
| 122 const chromeos::MountLibrary::MountPointInfo& mount_info); | 118 const chromeos::MountLibrary::MountPointInfo& mount_info); |
| 123 | 119 |
| 124 void RemoveBrowserFromVector(const std::string& path); | 120 void RemoveBrowserFromVector(const std::string& path); |
| 125 | 121 |
| 126 // Used to create a window of a standard size, and add it to a list | 122 // Used to create a window of a standard size, and add it to a list |
| 127 // of tracked browser windows in case that device goes away. | 123 // of tracked browser windows in case that device goes away. |
| 128 void OpenFileBrowse(const std::string& url, | 124 void OpenFileBrowse(const std::string& url, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 142 MountPointMap mounted_devices_; | 138 MountPointMap mounted_devices_; |
| 143 NotificationMap notifications_; | 139 NotificationMap notifications_; |
| 144 WatcherMap file_watchers_; | 140 WatcherMap file_watchers_; |
| 145 Profile* profile_; | 141 Profile* profile_; |
| 146 base::Lock lock_; | 142 base::Lock lock_; |
| 147 | 143 |
| 148 DISALLOW_COPY_AND_ASSIGN(ExtensionFileBrowserEventRouter); | 144 DISALLOW_COPY_AND_ASSIGN(ExtensionFileBrowserEventRouter); |
| 149 }; | 145 }; |
| 150 | 146 |
| 151 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ | 147 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ |
| OLD | NEW |