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_FILE_MANAGER_EVENT_ROUTE
R_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_MANAGER_EVENT_ROUTE
R_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_extension
s.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; |
27 class MountedDiskMonitor; | 27 class MountedDiskMonitor; |
28 | 28 |
29 // Monitors changes in disk mounts, network connection state and preferences | 29 // Monitors changes in disk mounts, network connection state and preferences |
30 // affecting File Manager. Dispatches appropriate File Browser events. | 30 // affecting File Manager. Dispatches appropriate File Browser events. |
31 class FileManagerEventRouter | 31 class EventRouter |
32 : public chromeos::disks::DiskMountManager::Observer, | 32 : public chromeos::disks::DiskMountManager::Observer, |
33 public chromeos::ConnectivityStateHelperObserver, | 33 public chromeos::ConnectivityStateHelperObserver, |
34 public drive::DriveIntegrationServiceObserver, | 34 public drive::DriveIntegrationServiceObserver, |
35 public drive::FileSystemObserver, | 35 public drive::FileSystemObserver, |
36 public drive::JobListObserver, | 36 public drive::JobListObserver, |
37 public drive::DriveServiceObserver { | 37 public drive::DriveServiceObserver { |
38 public: | 38 public: |
39 explicit FileManagerEventRouter(Profile* profile); | 39 explicit EventRouter(Profile* profile); |
40 virtual ~FileManagerEventRouter(); | 40 virtual ~EventRouter(); |
41 | 41 |
42 void Shutdown(); | 42 void Shutdown(); |
43 | 43 |
44 // Starts observing file system change events. | 44 // Starts observing file system change events. |
45 void ObserveFileSystemEvents(); | 45 void ObserveFileSystemEvents(); |
46 | 46 |
47 typedef base::Callback<void(bool success)> BoolCallback; | 47 typedef base::Callback<void(bool success)> BoolCallback; |
48 | 48 |
49 // Adds a file watch at |local_path|, associated with |virtual_path|, for | 49 // Adds a file watch at |local_path|, associated with |virtual_path|, for |
50 // an extension with |extension_id|. | 50 // an extension with |extension_id|. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 base::FilePathWatcher::Callback file_watcher_callback_; | 159 base::FilePathWatcher::Callback file_watcher_callback_; |
160 WatcherMap file_watchers_; | 160 WatcherMap file_watchers_; |
161 scoped_ptr<DesktopNotifications> notifications_; | 161 scoped_ptr<DesktopNotifications> notifications_; |
162 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; | 162 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
163 scoped_ptr<MountedDiskMonitor> mounted_disk_monitor_; | 163 scoped_ptr<MountedDiskMonitor> mounted_disk_monitor_; |
164 Profile* profile_; | 164 Profile* profile_; |
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<FileManagerEventRouter> weak_factory_; | 168 base::WeakPtrFactory<EventRouter> weak_factory_; |
169 DISALLOW_COPY_AND_ASSIGN(FileManagerEventRouter); | 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_FILE_MANAGER_EVENT_RO
UTER_H_ | 174 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
OLD | NEW |