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