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

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

Issue 553393002: Get rid of FileManagerPrivateAPI class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path_watcher.h" 13 #include "base/files/file_path_watcher.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 15 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
16 #include "chrome/browser/chromeos/drive/file_system_observer.h" 16 #include "chrome/browser/chromeos/drive/file_system_observer.h"
17 #include "chrome/browser/chromeos/drive/job_list.h" 17 #include "chrome/browser/chromeos/drive/job_list.h"
18 #include "chrome/browser/chromeos/drive/sync_client.h" 18 #include "chrome/browser/chromeos/drive/sync_client.h"
19 #include "chrome/browser/chromeos/file_manager/file_watcher.h" 19 #include "chrome/browser/chromeos/file_manager/file_watcher.h"
20 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" 20 #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
21 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 21 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
22 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h" 22 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h"
23 #include "chrome/browser/drive/drive_service_interface.h" 23 #include "chrome/browser/drive/drive_service_interface.h"
24 #include "chrome/common/extensions/api/file_manager_private.h" 24 #include "chrome/common/extensions/api/file_manager_private.h"
25 #include "chromeos/disks/disk_mount_manager.h" 25 #include "chromeos/disks/disk_mount_manager.h"
26 #include "chromeos/network/network_state_handler_observer.h" 26 #include "chromeos/network/network_state_handler_observer.h"
27 #include "components/keyed_service/core/keyed_service.h"
27 #include "storage/browser/fileapi/file_system_operation.h" 28 #include "storage/browser/fileapi/file_system_operation.h"
28 29
29 class PrefChangeRegistrar; 30 class PrefChangeRegistrar;
30 class Profile; 31 class Profile;
31 32
32 using file_manager::util::EntryDefinition; 33 using file_manager::util::EntryDefinition;
33 34
34 namespace base { 35 namespace base {
35 class ListValue; 36 class ListValue;
36 } 37 }
37 38
38 namespace chromeos { 39 namespace chromeos {
39 class NetworkState; 40 class NetworkState;
40 } 41 }
41 42
42 namespace drive { 43 namespace drive {
43 class FileChange; 44 class FileChange;
44 } 45 }
45 46
46 namespace file_manager { 47 namespace file_manager {
47 class DeviceEventRouter; 48 class DeviceEventRouter;
48 49
49 // Monitors changes in disk mounts, network connection state and preferences 50 // Monitors changes in disk mounts, network connection state and preferences
50 // affecting File Manager. Dispatches appropriate File Browser events. 51 // affecting File Manager. Dispatches appropriate File Browser events.
51 class EventRouter : public chromeos::NetworkStateHandlerObserver, 52 class EventRouter : public KeyedService,
53 public chromeos::NetworkStateHandlerObserver,
52 public drive::FileSystemObserver, 54 public drive::FileSystemObserver,
53 public drive::JobListObserver, 55 public drive::JobListObserver,
54 public drive::DriveServiceObserver, 56 public drive::DriveServiceObserver,
55 public VolumeManagerObserver { 57 public VolumeManagerObserver {
56 public: 58 public:
57 explicit EventRouter(Profile* profile); 59 explicit EventRouter(Profile* profile);
58 virtual ~EventRouter(); 60 virtual ~EventRouter();
59 61
60 void Shutdown(); 62 // KeyedService overrides.
61 63 virtual void Shutdown() OVERRIDE;
62 // Starts observing file system change events.
63 void ObserveEvents();
64 64
65 typedef base::Callback<void(bool success)> BoolCallback; 65 typedef base::Callback<void(bool success)> BoolCallback;
66 66
67 // Adds a file watch at |local_path|, associated with |virtual_path|, for 67 // Adds a file watch at |local_path|, associated with |virtual_path|, for
68 // an extension with |extension_id|. 68 // an extension with |extension_id|.
69 // 69 //
70 // |callback| will be called with true on success, or false on failure. 70 // |callback| will be called with true on success, or false on failure.
71 // |callback| must not be null. 71 // |callback| must not be null.
72 void AddFileWatch(const base::FilePath& local_path, 72 void AddFileWatch(const base::FilePath& local_path,
73 const base::FilePath& virtual_path, 73 const base::FilePath& virtual_path,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 virtual void OnVolumeUnmounted(chromeos::MountError error_code, 122 virtual void OnVolumeUnmounted(chromeos::MountError error_code,
123 const VolumeInfo& volume_info) OVERRIDE; 123 const VolumeInfo& volume_info) OVERRIDE;
124 virtual void OnFormatStarted( 124 virtual void OnFormatStarted(
125 const std::string& device_path, bool success) OVERRIDE; 125 const std::string& device_path, bool success) OVERRIDE;
126 virtual void OnFormatCompleted( 126 virtual void OnFormatCompleted(
127 const std::string& device_path, bool success) OVERRIDE; 127 const std::string& device_path, bool success) OVERRIDE;
128 128
129 private: 129 private:
130 typedef std::map<base::FilePath, FileWatcher*> WatcherMap; 130 typedef std::map<base::FilePath, FileWatcher*> WatcherMap;
131 131
132 // Starts observing file system change events.
133 void ObserveEvents();
134
132 // Called when prefs related to file manager change. 135 // Called when prefs related to file manager change.
133 void OnFileManagerPrefsChanged(); 136 void OnFileManagerPrefsChanged();
134 137
135 // Process file watch notifications. 138 // Process file watch notifications.
136 void HandleFileWatchNotification(const drive::FileChange* list, 139 void HandleFileWatchNotification(const drive::FileChange* list,
137 const base::FilePath& path, 140 const base::FilePath& path,
138 bool got_error); 141 bool got_error);
139 142
140 // Sends directory change event. 143 // Sends directory change event.
141 void DispatchDirectoryChangeEvent( 144 void DispatchDirectoryChangeEvent(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 204
202 // Note: This should remain the last member so it'll be destroyed and 205 // Note: This should remain the last member so it'll be destroyed and
203 // invalidate the weak pointers before any other members are destroyed. 206 // invalidate the weak pointers before any other members are destroyed.
204 base::WeakPtrFactory<EventRouter> weak_factory_; 207 base::WeakPtrFactory<EventRouter> weak_factory_;
205 DISALLOW_COPY_AND_ASSIGN(EventRouter); 208 DISALLOW_COPY_AND_ASSIGN(EventRouter);
206 }; 209 };
207 210
208 } // namespace file_manager 211 } // namespace file_manager
209 212
210 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ 213 #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