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> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // CrosDisksClient events are being observed. | 45 // CrosDisksClient events are being observed. |
46 void ObserveFileSystemEvents(); | 46 void ObserveFileSystemEvents(); |
47 | 47 |
48 // File watch setup routines. | 48 // File watch setup routines. |
49 bool AddFileWatch(const FilePath& file_path, | 49 bool AddFileWatch(const FilePath& file_path, |
50 const FilePath& virtual_path, | 50 const FilePath& virtual_path, |
51 const std::string& extension_id); | 51 const std::string& extension_id); |
52 void RemoveFileWatch(const FilePath& file_path, | 52 void RemoveFileWatch(const FilePath& file_path, |
53 const std::string& extension_id); | 53 const std::string& extension_id); |
54 | 54 |
| 55 // Mounts Drive on File browser. |callback| will be called after raising a |
| 56 // mount request event to file manager on JS-side. |
| 57 void MountDrive(const base::Closure& callback); |
| 58 |
55 // CrosDisksClient::Observer overrides. | 59 // CrosDisksClient::Observer overrides. |
56 virtual void DiskChanged(chromeos::disks::DiskMountManagerEventType event, | 60 virtual void DiskChanged(chromeos::disks::DiskMountManagerEventType event, |
57 const chromeos::disks::DiskMountManager::Disk* disk) | 61 const chromeos::disks::DiskMountManager::Disk* disk) |
58 OVERRIDE; | 62 OVERRIDE; |
59 virtual void DeviceChanged(chromeos::disks::DiskMountManagerEventType event, | 63 virtual void DeviceChanged(chromeos::disks::DiskMountManagerEventType event, |
60 const std::string& device_path) OVERRIDE; | 64 const std::string& device_path) OVERRIDE; |
61 virtual void MountCompleted( | 65 virtual void MountCompleted( |
62 chromeos::disks::DiskMountManager::MountEvent event_type, | 66 chromeos::disks::DiskMountManager::MountEvent event_type, |
63 chromeos::MountError error_code, | 67 chromeos::MountError error_code, |
64 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) | 68 const chromeos::disks::DiskMountManager::MountPointInfo& mount_info) |
(...skipping 10 matching lines...) Expand all Loading... |
75 | 79 |
76 // GDataOperationRegistry::Observer overrides. | 80 // GDataOperationRegistry::Observer overrides. |
77 virtual void OnProgressUpdate( | 81 virtual void OnProgressUpdate( |
78 const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) | 82 const std::vector<gdata::GDataOperationRegistry::ProgressStatus>& list) |
79 OVERRIDE; | 83 OVERRIDE; |
80 virtual void OnAuthenticationFailed() OVERRIDE; | 84 virtual void OnAuthenticationFailed() OVERRIDE; |
81 | 85 |
82 // gdata::GDataFileSystemInterface::Observer overrides. | 86 // gdata::GDataFileSystemInterface::Observer overrides. |
83 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; | 87 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; |
84 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; | 88 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; |
| 89 virtual void OnFileSystemMounted() OVERRIDE; |
| 90 virtual void OnFileSystemUnmounting() OVERRIDE; |
85 | 91 |
86 private: | 92 private: |
87 friend class FileBrowserEventRouterFactory; | 93 friend class FileBrowserEventRouterFactory; |
88 | 94 |
89 // Helper class for passing through file watch notification events. | 95 // Helper class for passing through file watch notification events. |
90 class FileWatcherDelegate : public base::files::FilePathWatcher::Delegate { | 96 class FileWatcherDelegate : public base::files::FilePathWatcher::Delegate { |
91 public: | 97 public: |
92 explicit FileWatcherDelegate(FileBrowserEventRouter* router); | 98 explicit FileWatcherDelegate(FileBrowserEventRouter* router); |
93 | 99 |
94 protected: | 100 protected: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Returns the GDataFileSystem for the current profile. | 185 // Returns the GDataFileSystem for the current profile. |
180 gdata::GDataFileSystemInterface* GetRemoteFileSystem() const; | 186 gdata::GDataFileSystemInterface* GetRemoteFileSystem() const; |
181 | 187 |
182 // Handles requests to start and stop periodic updates on remote file system. | 188 // Handles requests to start and stop periodic updates on remote file system. |
183 // When |start| is set to true, this function starts periodic updates only if | 189 // When |start| is set to true, this function starts periodic updates only if |
184 // it is not yet started; when |start| is set to false, this function stops | 190 // it is not yet started; when |start| is set to false, this function stops |
185 // periodic updates only if the number of outstanding update requests reaches | 191 // periodic updates only if the number of outstanding update requests reaches |
186 // zero. | 192 // zero. |
187 void HandleRemoteUpdateRequestOnUIThread(bool start); | 193 void HandleRemoteUpdateRequestOnUIThread(bool start); |
188 | 194 |
| 195 // Used to implement MountDrive(). Called after the authentication. |
| 196 void OnDriveAuthentication(const base::Closure& callback, |
| 197 gdata::GDataErrorCode error, |
| 198 const std::string& tokeni); |
| 199 |
189 scoped_refptr<FileWatcherDelegate> delegate_; | 200 scoped_refptr<FileWatcherDelegate> delegate_; |
190 WatcherMap file_watchers_; | 201 WatcherMap file_watchers_; |
191 scoped_ptr<FileBrowserNotifications> notifications_; | 202 scoped_ptr<FileBrowserNotifications> notifications_; |
192 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; | 203 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
193 Profile* profile_; | 204 Profile* profile_; |
194 base::Lock lock_; | 205 base::Lock lock_; |
195 | 206 |
196 bool current_gdata_operation_failed_; | 207 bool current_gdata_operation_failed_; |
197 int last_active_gdata_operation_count_; | 208 int last_active_gdata_operation_count_; |
198 | 209 |
(...skipping 24 matching lines...) Expand all Loading... |
223 | 234 |
224 FileBrowserEventRouterFactory(); | 235 FileBrowserEventRouterFactory(); |
225 virtual ~FileBrowserEventRouterFactory(); | 236 virtual ~FileBrowserEventRouterFactory(); |
226 | 237 |
227 // ProfileKeyedServiceFactory: | 238 // ProfileKeyedServiceFactory: |
228 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( | 239 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( |
229 Profile* profile) const OVERRIDE; | 240 Profile* profile) const OVERRIDE; |
230 }; | 241 }; |
231 | 242 |
232 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ | 243 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ |
OLD | NEW |