| 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 28 matching lines...) Expand all Loading... |
| 39 const FilePath& virtual_path, | 39 const FilePath& virtual_path, |
| 40 const std::string& extension_id); | 40 const std::string& extension_id); |
| 41 void RemoveFileWatch(const FilePath& file_path, | 41 void RemoveFileWatch(const FilePath& file_path, |
| 42 const std::string& extension_id); | 42 const std::string& extension_id); |
| 43 | 43 |
| 44 // MountLibrary::Observer overrides. | 44 // MountLibrary::Observer overrides. |
| 45 virtual void DiskChanged(chromeos::MountLibraryEventType event, | 45 virtual void DiskChanged(chromeos::MountLibraryEventType event, |
| 46 const chromeos::MountLibrary::Disk* disk) OVERRIDE; | 46 const chromeos::MountLibrary::Disk* disk) OVERRIDE; |
| 47 virtual void DeviceChanged(chromeos::MountLibraryEventType event, | 47 virtual void DeviceChanged(chromeos::MountLibraryEventType event, |
| 48 const std::string& device_path) OVERRIDE; | 48 const std::string& device_path) OVERRIDE; |
| 49 virtual void MountCompleted(chromeos::MountLibrary::MountEvent event_type, |
| 50 chromeos::MountError error_code, |
| 51 const chromeos::MountLibrary::MountPointInfo& mount_info) |
| 52 OVERRIDE; |
| 49 | 53 |
| 50 private: | 54 private: |
| 51 typedef std::map<std::string, linked_ptr<chromeos::SystemNotification> > | 55 typedef std::map<std::string, linked_ptr<chromeos::SystemNotification> > |
| 52 NotificationMap; | 56 NotificationMap; |
| 53 typedef std::map<std::string, std::string> MountPointMap; | 57 typedef std::map<std::string, std::string> MountPointMap; |
| 54 typedef struct FileWatcherExtensions { | 58 typedef struct FileWatcherExtensions { |
| 55 FileWatcherExtensions(const FilePath& path, const std::string& extension_id)
{ | 59 FileWatcherExtensions(const FilePath& path, const std::string& extension_id)
{ |
| 56 file_watcher.reset(new base::files::FilePathWatcher()); | 60 file_watcher.reset(new base::files::FilePathWatcher()); |
| 57 virtual_path = path; | 61 virtual_path = path; |
| 58 extensions.insert(extension_id); | 62 extensions.insert(extension_id); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 void HandleFileWatchNotification(const FilePath& path, | 100 void HandleFileWatchNotification(const FilePath& path, |
| 97 bool got_error); | 101 bool got_error); |
| 98 | 102 |
| 99 // Sends folder change event. | 103 // Sends folder change event. |
| 100 void DispatchFolderChangeEvent(const FilePath& path, bool error, | 104 void DispatchFolderChangeEvent(const FilePath& path, bool error, |
| 101 const std::set<std::string>& extensions); | 105 const std::set<std::string>& extensions); |
| 102 | 106 |
| 103 // Sends filesystem changed extension message to all renderers. | 107 // Sends filesystem changed extension message to all renderers. |
| 104 void DispatchMountEvent(const chromeos::MountLibrary::Disk* disk, bool added); | 108 void DispatchMountEvent(const chromeos::MountLibrary::Disk* disk, bool added); |
| 105 | 109 |
| 110 void DispatchMountCompletedEvent(chromeos::MountLibrary::MountEvent event, |
| 111 chromeos::MountError error_code, |
| 112 const chromeos::MountLibrary::MountPointInfo& mount_info); |
| 113 |
| 106 void RemoveBrowserFromVector(const std::string& path); | 114 void RemoveBrowserFromVector(const std::string& path); |
| 107 | 115 |
| 108 // Used to create a window of a standard size, and add it to a list | 116 // Used to create a window of a standard size, and add it to a list |
| 109 // of tracked browser windows in case that device goes away. | 117 // of tracked browser windows in case that device goes away. |
| 110 void OpenFileBrowse(const std::string& url, | 118 void OpenFileBrowse(const std::string& url, |
| 111 const std::string& device_path, | 119 const std::string& device_path, |
| 112 bool small); | 120 bool small); |
| 113 | 121 |
| 114 // Show/hide desktop notifications. | 122 // Show/hide desktop notifications. |
| 115 void ShowDeviceNotification(const std::string& system_path, | 123 void ShowDeviceNotification(const std::string& system_path, |
| 116 int icon_resource_id, | 124 int icon_resource_id, |
| 117 const string16& message); | 125 const string16& message); |
| 118 void HideDeviceNotification(const std::string& system_path); | 126 void HideDeviceNotification(const std::string& system_path); |
| 119 | 127 |
| 120 scoped_refptr<FileWatcherDelegate> delegate_; | 128 scoped_refptr<FileWatcherDelegate> delegate_; |
| 121 MountPointMap mounted_devices_; | 129 MountPointMap mounted_devices_; |
| 122 NotificationMap notifications_; | 130 NotificationMap notifications_; |
| 123 WatcherMap file_watchers_; | 131 WatcherMap file_watchers_; |
| 124 Profile* profile_; | 132 Profile* profile_; |
| 125 base::Lock lock_; | 133 base::Lock lock_; |
| 126 | 134 |
| 127 DISALLOW_COPY_AND_ASSIGN(ExtensionFileBrowserEventRouter); | 135 DISALLOW_COPY_AND_ASSIGN(ExtensionFileBrowserEventRouter); |
| 128 }; | 136 }; |
| 129 | 137 |
| 130 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ | 138 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ |
| OLD | NEW |