| 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_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/files/file_path_watcher.h" | 16 #include "base/files/file_path_watcher.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 18 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 19 #include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h" | 19 #include "chrome/browser/chromeos/extensions/file_manager/device_event_router.h" |
| 20 #include "chrome/browser/chromeos/extensions/file_manager/job_event_router.h" | 20 #include "chrome/browser/chromeos/extensions/file_manager/job_event_router.h" |
| 21 #include "chrome/browser/chromeos/file_manager/file_watcher.h" | 21 #include "chrome/browser/chromeos/file_manager/file_watcher.h" |
| 22 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 22 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 23 #include "chrome/browser/chromeos/file_manager/volume_manager.h" | 23 #include "chrome/browser/chromeos/file_manager/volume_manager.h" |
| 24 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" | 24 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" |
| 25 #include "chrome/common/extensions/api/file_manager_private.h" | 25 #include "chrome/common/extensions/api/file_manager_private.h" |
| 26 #include "chromeos/disks/disk_mount_manager.h" | 26 #include "chromeos/disks/disk_mount_manager.h" |
| 27 #include "chromeos/network/network_state_handler_observer.h" | 27 #include "chromeos/network/network_state_handler_observer.h" |
| 28 #include "chromeos/settings/timezone_settings.h" | 28 #include "chromeos/settings/timezone_settings.h" |
| 29 #include "components/arc/arc_service_manager.h" |
| 29 #include "components/drive/chromeos/file_system_observer.h" | 30 #include "components/drive/chromeos/file_system_observer.h" |
| 30 #include "components/drive/chromeos/sync_client.h" | 31 #include "components/drive/chromeos/sync_client.h" |
| 31 #include "components/drive/service/drive_service_interface.h" | 32 #include "components/drive/service/drive_service_interface.h" |
| 32 #include "components/keyed_service/core/keyed_service.h" | 33 #include "components/keyed_service/core/keyed_service.h" |
| 33 #include "storage/browser/fileapi/file_system_operation.h" | 34 #include "storage/browser/fileapi/file_system_operation.h" |
| 34 | 35 |
| 35 class PrefChangeRegistrar; | 36 class PrefChangeRegistrar; |
| 36 class Profile; | 37 class Profile; |
| 37 | 38 |
| 38 using file_manager::util::EntryDefinition; | 39 using file_manager::util::EntryDefinition; |
| 39 | 40 |
| 40 namespace chromeos { | 41 namespace chromeos { |
| 41 class NetworkState; | 42 class NetworkState; |
| 42 } | 43 } |
| 43 | 44 |
| 44 namespace drive { | 45 namespace drive { |
| 45 class FileChange; | 46 class FileChange; |
| 46 } | 47 } |
| 47 | 48 |
| 48 namespace file_manager { | 49 namespace file_manager { |
| 49 | 50 |
| 50 // Monitors changes in disk mounts, network connection state and preferences | 51 // Monitors changes in disk mounts, network connection state and preferences |
| 51 // affecting File Manager. Dispatches appropriate File Browser events. | 52 // affecting File Manager. Dispatches appropriate File Browser events. |
| 52 class EventRouter : public KeyedService, | 53 class EventRouter : public KeyedService, |
| 53 public chromeos::NetworkStateHandlerObserver, | 54 public chromeos::NetworkStateHandlerObserver, |
| 54 public chromeos::system::TimezoneSettings::Observer, | 55 public chromeos::system::TimezoneSettings::Observer, |
| 55 public drive::FileSystemObserver, | 56 public drive::FileSystemObserver, |
| 56 public drive::DriveServiceObserver, | 57 public drive::DriveServiceObserver, |
| 57 public VolumeManagerObserver { | 58 public VolumeManagerObserver, |
| 59 public arc::ArcServiceManager::Observer { |
| 58 public: | 60 public: |
| 59 typedef base::Callback<void(const base::FilePath& virtual_path, | 61 typedef base::Callback<void(const base::FilePath& virtual_path, |
| 60 const drive::FileChange* list, | 62 const drive::FileChange* list, |
| 61 bool got_error, | 63 bool got_error, |
| 62 const std::vector<std::string>& extension_ids)> | 64 const std::vector<std::string>& extension_ids)> |
| 63 DispatchDirectoryChangeEventImplCallback; | 65 DispatchDirectoryChangeEventImplCallback; |
| 64 | 66 |
| 65 explicit EventRouter(Profile* profile); | 67 explicit EventRouter(Profile* profile); |
| 66 ~EventRouter() override; | 68 ~EventRouter() override; |
| 67 | 69 |
| 70 // arc::ArcServiceManager::Observer overrides. |
| 71 void OnAppsUpdated() override; |
| 72 |
| 68 // KeyedService overrides. | 73 // KeyedService overrides. |
| 69 void Shutdown() override; | 74 void Shutdown() override; |
| 70 | 75 |
| 71 typedef base::Callback<void(bool success)> BoolCallback; | 76 typedef base::Callback<void(bool success)> BoolCallback; |
| 72 | 77 |
| 73 // Adds a file watch at |local_path|, associated with |virtual_path|, for | 78 // Adds a file watch at |local_path|, associated with |virtual_path|, for |
| 74 // an extension with |extension_id|. | 79 // an extension with |extension_id|. |
| 75 // | 80 // |
| 76 // |callback| will be called with true on success, or false on failure. | 81 // |callback| will be called with true on success, or false on failure. |
| 77 // |callback| must not be null. | 82 // |callback| must not be null. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // Note: This should remain the last member so it'll be destroyed and | 226 // Note: This should remain the last member so it'll be destroyed and |
| 222 // invalidate the weak pointers before any other members are destroyed. | 227 // invalidate the weak pointers before any other members are destroyed. |
| 223 base::WeakPtrFactory<EventRouter> weak_factory_; | 228 base::WeakPtrFactory<EventRouter> weak_factory_; |
| 224 | 229 |
| 225 DISALLOW_COPY_AND_ASSIGN(EventRouter); | 230 DISALLOW_COPY_AND_ASSIGN(EventRouter); |
| 226 }; | 231 }; |
| 227 | 232 |
| 228 } // namespace file_manager | 233 } // namespace file_manager |
| 229 | 234 |
| 230 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 235 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| OLD | NEW |