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 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" | 23 #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" |
24 #include "chromeos/disks/disk_mount_manager.h" | 24 #include "chromeos/disks/disk_mount_manager.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
27 #include "content/public/browser/notification_source.h" | 27 #include "content/public/browser/notification_source.h" |
28 | 28 |
29 class FileBrowserNotifications; | 29 class FileBrowserNotifications; |
30 class PrefChangeRegistrar; | 30 class PrefChangeRegistrar; |
31 class Profile; | 31 class Profile; |
32 | 32 |
33 namespace gdata { | 33 namespace drive { |
34 class DriveEntryProto; | 34 class DriveEntryProto; |
35 class DriveFileSystemInterface; | 35 class DriveFileSystemInterface; |
36 } | 36 } |
37 | 37 |
38 // Monitors changes in disk mounts, network connection state and preferences | 38 // Monitors changes in disk mounts, network connection state and preferences |
39 // affecting File Manager. Dispatches appropriate File Browser events. | 39 // affecting File Manager. Dispatches appropriate File Browser events. |
40 class FileBrowserEventRouter | 40 class FileBrowserEventRouter |
41 : public RefcountedProfileKeyedService, | 41 : public RefcountedProfileKeyedService, |
42 public chromeos::disks::DiskMountManager::Observer, | 42 public chromeos::disks::DiskMountManager::Observer, |
43 public chromeos::NetworkLibrary::NetworkManagerObserver, | 43 public chromeos::NetworkLibrary::NetworkManagerObserver, |
44 public content::NotificationObserver, | 44 public content::NotificationObserver, |
45 public gdata::DriveFileSystemObserver, | 45 public drive::DriveFileSystemObserver, |
46 public gdata::DriveServiceObserver { | 46 public drive::DriveServiceObserver { |
47 public: | 47 public: |
48 // RefcountedProfileKeyedService overrides. | 48 // RefcountedProfileKeyedService overrides. |
49 virtual void ShutdownOnUIThread() OVERRIDE; | 49 virtual void ShutdownOnUIThread() OVERRIDE; |
50 | 50 |
51 // Starts observing file system change events. Currently only | 51 // Starts observing file system change events. Currently only |
52 // CrosDisksClient events are being observed. | 52 // CrosDisksClient events are being observed. |
53 void ObserveFileSystemEvents(); | 53 void ObserveFileSystemEvents(); |
54 | 54 |
55 // File watch setup routines. | 55 // File watch setup routines. |
56 bool AddFileWatch(const FilePath& file_path, | 56 bool AddFileWatch(const FilePath& file_path, |
(...skipping 20 matching lines...) Expand all Loading... |
77 | 77 |
78 // chromeos::NetworkLibrary::NetworkManagerObserver override. | 78 // chromeos::NetworkLibrary::NetworkManagerObserver override. |
79 virtual void OnNetworkManagerChanged( | 79 virtual void OnNetworkManagerChanged( |
80 chromeos::NetworkLibrary* network_library) OVERRIDE; | 80 chromeos::NetworkLibrary* network_library) OVERRIDE; |
81 | 81 |
82 // Overridden from content::NotificationObserver: | 82 // Overridden from content::NotificationObserver: |
83 virtual void Observe(int type, | 83 virtual void Observe(int type, |
84 const content::NotificationSource& source, | 84 const content::NotificationSource& source, |
85 const content::NotificationDetails& details) OVERRIDE; | 85 const content::NotificationDetails& details) OVERRIDE; |
86 | 86 |
87 // gdata::DriveServiceObserver overrides. | 87 // drive::DriveServiceObserver overrides. |
88 virtual void OnProgressUpdate( | 88 virtual void OnProgressUpdate( |
89 const gdata::OperationProgressStatusList& list) OVERRIDE; | 89 const gdata::OperationProgressStatusList& list) OVERRIDE; |
90 virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) OVERRIDE; | 90 virtual void OnAuthenticationFailed(gdata::GDataErrorCode error) OVERRIDE; |
91 | 91 |
92 // gdata::DriveFileSystemInterface::Observer overrides. | 92 // drive::DriveFileSystemInterface::Observer overrides. |
93 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; | 93 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; |
94 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; | 94 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; |
95 virtual void OnFileSystemMounted() OVERRIDE; | 95 virtual void OnFileSystemMounted() OVERRIDE; |
96 virtual void OnFileSystemBeingUnmounted() OVERRIDE; | 96 virtual void OnFileSystemBeingUnmounted() OVERRIDE; |
97 | 97 |
98 private: | 98 private: |
99 friend class FileBrowserEventRouterFactory; | 99 friend class FileBrowserEventRouterFactory; |
100 | 100 |
101 // Helper class for passing through file watch notification events. | 101 // Helper class for passing through file watch notification events. |
102 class FileWatcherDelegate : public base::files::FilePathWatcher::Delegate { | 102 class FileWatcherDelegate : public base::files::FilePathWatcher::Delegate { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 void RemoveBrowserFromVector(const std::string& path); | 183 void RemoveBrowserFromVector(const std::string& path); |
184 | 184 |
185 // Used to create a window of a standard size, and add it to a list | 185 // Used to create a window of a standard size, and add it to a list |
186 // of tracked browser windows in case that device goes away. | 186 // of tracked browser windows in case that device goes away. |
187 void OpenFileBrowse(const std::string& url, | 187 void OpenFileBrowse(const std::string& url, |
188 const std::string& device_path, | 188 const std::string& device_path, |
189 bool small); | 189 bool small); |
190 | 190 |
191 // Returns the DriveFileSystem for the current profile. | 191 // Returns the DriveFileSystem for the current profile. |
192 gdata::DriveFileSystemInterface* GetRemoteFileSystem() const; | 192 drive::DriveFileSystemInterface* GetRemoteFileSystem() const; |
193 | 193 |
194 // Handles requests to start and stop periodic updates on remote file system. | 194 // Handles requests to start and stop periodic updates on remote file system. |
195 // When |start| is set to true, this function starts periodic updates only if | 195 // When |start| is set to true, this function starts periodic updates only if |
196 // it is not yet started; when |start| is set to false, this function stops | 196 // it is not yet started; when |start| is set to false, this function stops |
197 // periodic updates only if the number of outstanding update requests reaches | 197 // periodic updates only if the number of outstanding update requests reaches |
198 // zero. | 198 // zero. |
199 void HandleRemoteUpdateRequestOnUIThread(bool start); | 199 void HandleRemoteUpdateRequestOnUIThread(bool start); |
200 | 200 |
201 // Used to implement MountDrive(). Called after the authentication. | 201 // Used to implement MountDrive(). Called after the authentication. |
202 void OnAuthenticated(const base::Closure& callback, | 202 void OnAuthenticated(const base::Closure& callback, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 FileBrowserEventRouterFactory(); | 241 FileBrowserEventRouterFactory(); |
242 virtual ~FileBrowserEventRouterFactory(); | 242 virtual ~FileBrowserEventRouterFactory(); |
243 | 243 |
244 // ProfileKeyedServiceFactory: | 244 // ProfileKeyedServiceFactory: |
245 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( | 245 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( |
246 Profile* profile) const OVERRIDE; | 246 Profile* profile) const OVERRIDE; |
247 }; | 247 }; |
248 | 248 |
249 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ | 249 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_EVENT_ROUTER_H_ |
OLD | NEW |