Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/event_router.h

Issue 566433004: Add notification and observer to copy the file between other users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/event_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 namespace file_manager { 46 namespace file_manager {
47 class DeviceEventRouter; 47 class DeviceEventRouter;
48 48
49 // Monitors changes in disk mounts, network connection state and preferences 49 // Monitors changes in disk mounts, network connection state and preferences
50 // affecting File Manager. Dispatches appropriate File Browser events. 50 // affecting File Manager. Dispatches appropriate File Browser events.
51 class EventRouter : public chromeos::NetworkStateHandlerObserver, 51 class EventRouter : public chromeos::NetworkStateHandlerObserver,
52 public drive::FileSystemObserver, 52 public drive::FileSystemObserver,
53 public drive::JobListObserver, 53 public drive::JobListObserver,
54 public drive::DriveServiceObserver, 54 public drive::DriveServiceObserver,
55 public VolumeManagerObserver { 55 public VolumeManagerObserver,
56 public content::NotificationObserver {
56 public: 57 public:
57 explicit EventRouter(Profile* profile); 58 explicit EventRouter(Profile* profile);
58 virtual ~EventRouter(); 59 virtual ~EventRouter();
59 60
60 void Shutdown(); 61 void Shutdown();
61 62
62 // Starts observing file system change events. 63 // Starts observing file system change events.
63 void ObserveEvents(); 64 void ObserveEvents();
64 65
65 typedef base::Callback<void(bool success)> BoolCallback; 66 typedef base::Callback<void(bool success)> BoolCallback;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 virtual void OnDeviceRemoved(const std::string& device_path) OVERRIDE; 120 virtual void OnDeviceRemoved(const std::string& device_path) OVERRIDE;
120 virtual void OnVolumeMounted(chromeos::MountError error_code, 121 virtual void OnVolumeMounted(chromeos::MountError error_code,
121 const VolumeInfo& volume_info) OVERRIDE; 122 const VolumeInfo& volume_info) OVERRIDE;
122 virtual void OnVolumeUnmounted(chromeos::MountError error_code, 123 virtual void OnVolumeUnmounted(chromeos::MountError error_code,
123 const VolumeInfo& volume_info) OVERRIDE; 124 const VolumeInfo& volume_info) OVERRIDE;
124 virtual void OnFormatStarted( 125 virtual void OnFormatStarted(
125 const std::string& device_path, bool success) OVERRIDE; 126 const std::string& device_path, bool success) OVERRIDE;
126 virtual void OnFormatCompleted( 127 virtual void OnFormatCompleted(
127 const std::string& device_path, bool success) OVERRIDE; 128 const std::string& device_path, bool success) OVERRIDE;
128 129
130 // content::NotificationObserver overrides.
131 virtual void Observe(int type,
132 const content::NotificationSource& source,
133 const content::NotificationDetails& details) OVERRIDE;
134
129 private: 135 private:
130 typedef std::map<base::FilePath, FileWatcher*> WatcherMap; 136 typedef std::map<base::FilePath, FileWatcher*> WatcherMap;
131 137
132 // Called when prefs related to file manager change. 138 // Called when prefs related to file manager change.
133 void OnFileManagerPrefsChanged(); 139 void OnFileManagerPrefsChanged();
134 140
135 // Process file watch notifications. 141 // Process file watch notifications.
136 void HandleFileWatchNotification(const drive::FileChange* list, 142 void HandleFileWatchNotification(const drive::FileChange* list,
137 const base::FilePath& path, 143 const base::FilePath& path,
138 bool got_error); 144 bool got_error);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 196
191 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; 197 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_;
192 scoped_ptr<DriveJobInfoWithStatus> drive_job_info_for_scheduled_event_; 198 scoped_ptr<DriveJobInfoWithStatus> drive_job_info_for_scheduled_event_;
193 base::Time last_copy_progress_event_; 199 base::Time last_copy_progress_event_;
194 base::Time next_send_file_transfer_event_; 200 base::Time next_send_file_transfer_event_;
195 201
196 WatcherMap file_watchers_; 202 WatcherMap file_watchers_;
197 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; 203 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
198 Profile* profile_; 204 Profile* profile_;
199 205
206 content::NotificationRegistrar notification_registrar_;
207
200 scoped_ptr<DeviceEventRouter> device_event_router_; 208 scoped_ptr<DeviceEventRouter> device_event_router_;
201 209
202 // Note: This should remain the last member so it'll be destroyed and 210 // Note: This should remain the last member so it'll be destroyed and
203 // invalidate the weak pointers before any other members are destroyed. 211 // invalidate the weak pointers before any other members are destroyed.
204 base::WeakPtrFactory<EventRouter> weak_factory_; 212 base::WeakPtrFactory<EventRouter> weak_factory_;
205 DISALLOW_COPY_AND_ASSIGN(EventRouter); 213 DISALLOW_COPY_AND_ASSIGN(EventRouter);
206 }; 214 };
207 215
208 } // namespace file_manager 216 } // namespace file_manager
209 217
210 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ 218 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_manager/event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698