| 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_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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/files/file_path_watcher.h" | 12 #include "base/files/file_path_watcher.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/prefs/public/pref_observer.h" |
| 15 #include "base/string16.h" | 16 #include "base/string16.h" |
| 16 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
| 17 #include "chrome/browser/chromeos/cros/network_library.h" | 18 #include "chrome/browser/chromeos/cros/network_library.h" |
| 18 #include "chrome/browser/chromeos/drive/drive_file_system_observer.h" | 19 #include "chrome/browser/chromeos/drive/drive_file_system_observer.h" |
| 19 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" | 20 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" |
| 20 #include "chrome/browser/google_apis/drive_service_interface.h" | 21 #include "chrome/browser/google_apis/drive_service_interface.h" |
| 21 #include "chrome/browser/google_apis/operation_registry.h" | 22 #include "chrome/browser/google_apis/operation_registry.h" |
| 22 #include "chrome/browser/profiles/refcounted_profile_keyed_service.h" | 23 #include "chrome/browser/profiles/refcounted_profile_keyed_service.h" |
| 23 #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" | 24 #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" |
| 24 #include "chromeos/disks/disk_mount_manager.h" | 25 #include "chromeos/disks/disk_mount_manager.h" |
| 25 #include "content/public/browser/notification_details.h" | |
| 26 #include "content/public/browser/notification_observer.h" | |
| 27 #include "content/public/browser/notification_source.h" | |
| 28 | 26 |
| 29 class FileBrowserNotifications; | 27 class FileBrowserNotifications; |
| 30 class PrefChangeRegistrar; | 28 class PrefChangeRegistrar; |
| 31 class Profile; | 29 class Profile; |
| 32 | 30 |
| 33 namespace drive { | 31 namespace drive { |
| 34 class DriveEntryProto; | 32 class DriveEntryProto; |
| 35 class DriveFileSystemInterface; | 33 class DriveFileSystemInterface; |
| 36 } | 34 } |
| 37 | 35 |
| 38 // Monitors changes in disk mounts, network connection state and preferences | 36 // Monitors changes in disk mounts, network connection state and preferences |
| 39 // affecting File Manager. Dispatches appropriate File Browser events. | 37 // affecting File Manager. Dispatches appropriate File Browser events. |
| 40 class FileBrowserEventRouter | 38 class FileBrowserEventRouter |
| 41 : public RefcountedProfileKeyedService, | 39 : public RefcountedProfileKeyedService, |
| 42 public chromeos::disks::DiskMountManager::Observer, | 40 public chromeos::disks::DiskMountManager::Observer, |
| 43 public chromeos::NetworkLibrary::NetworkManagerObserver, | 41 public chromeos::NetworkLibrary::NetworkManagerObserver, |
| 44 public content::NotificationObserver, | 42 public PrefObserver, |
| 45 public drive::DriveFileSystemObserver, | 43 public drive::DriveFileSystemObserver, |
| 46 public google_apis::DriveServiceObserver { | 44 public google_apis::DriveServiceObserver { |
| 47 public: | 45 public: |
| 48 // RefcountedProfileKeyedService overrides. | 46 // RefcountedProfileKeyedService overrides. |
| 49 virtual void ShutdownOnUIThread() OVERRIDE; | 47 virtual void ShutdownOnUIThread() OVERRIDE; |
| 50 | 48 |
| 51 // Starts observing file system change events. Currently only | 49 // Starts observing file system change events. Currently only |
| 52 // CrosDisksClient events are being observed. | 50 // CrosDisksClient events are being observed. |
| 53 void ObserveFileSystemEvents(); | 51 void ObserveFileSystemEvents(); |
| 54 | 52 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 virtual void MountCompleted( | 70 virtual void MountCompleted( |
| 73 chromeos::disks::DiskMountManager::MountEvent event_type, | 71 chromeos::disks::DiskMountManager::MountEvent event_type, |
| 74 chromeos::MountError error_code, | 72 chromeos::MountError error_code, |
| 75 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) | 73 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) |
| 76 OVERRIDE; | 74 OVERRIDE; |
| 77 | 75 |
| 78 // chromeos::NetworkLibrary::NetworkManagerObserver override. | 76 // chromeos::NetworkLibrary::NetworkManagerObserver override. |
| 79 virtual void OnNetworkManagerChanged( | 77 virtual void OnNetworkManagerChanged( |
| 80 chromeos::NetworkLibrary* network_library) OVERRIDE; | 78 chromeos::NetworkLibrary* network_library) OVERRIDE; |
| 81 | 79 |
| 82 // Overridden from content::NotificationObserver: | 80 // Overridden from PrefObserver. |
| 83 virtual void Observe(int type, | 81 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 84 const content::NotificationSource& source, | 82 const std::string& pref_name) OVERRIDE; |
| 85 const content::NotificationDetails& details) OVERRIDE; | |
| 86 | 83 |
| 87 // drive::DriveServiceObserver overrides. | 84 // drive::DriveServiceObserver overrides. |
| 88 virtual void OnProgressUpdate( | 85 virtual void OnProgressUpdate( |
| 89 const google_apis::OperationProgressStatusList& list) OVERRIDE; | 86 const google_apis::OperationProgressStatusList& list) OVERRIDE; |
| 90 virtual void OnAuthenticationFailed( | 87 virtual void OnAuthenticationFailed( |
| 91 google_apis::GDataErrorCode error) OVERRIDE; | 88 google_apis::GDataErrorCode error) OVERRIDE; |
| 92 | 89 |
| 93 // drive::DriveFileSystemInterface::Observer overrides. | 90 // drive::DriveFileSystemInterface::Observer overrides. |
| 94 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; | 91 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; |
| 95 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; | 92 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 238 |
| 242 FileBrowserEventRouterFactory(); | 239 FileBrowserEventRouterFactory(); |
| 243 virtual ~FileBrowserEventRouterFactory(); | 240 virtual ~FileBrowserEventRouterFactory(); |
| 244 | 241 |
| 245 // ProfileKeyedServiceFactory: | 242 // ProfileKeyedServiceFactory: |
| 246 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( | 243 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( |
| 247 Profile* profile) const OVERRIDE; | 244 Profile* profile) const OVERRIDE; |
| 248 }; | 245 }; |
| 249 | 246 |
| 250 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ | 247 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ |
| OLD | NEW |