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

Unified Diff: chrome/browser/chromeos/extensions/file_browser_event_router.h

Issue 7745051: Added refresh on filesystem change (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Flacky test Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_browser_event_router.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/extensions/file_browser_event_router.h
diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.h b/chrome/browser/chromeos/extensions/file_browser_event_router.h
index 53cdaf960ba12b6633ded78264bb969171aae45d..b9d2b231564a9fa3572c52c2ca53bf0f0380efdb 100644
--- a/chrome/browser/chromeos/extensions/file_browser_event_router.h
+++ b/chrome/browser/chromeos/extensions/file_browser_event_router.h
@@ -48,21 +48,6 @@ class ExtensionFileBrowserEventRouter
const chromeos::MountLibrary::MountPointInfo& mount_info) OVERRIDE;
private:
- typedef struct FileWatcherExtensions {
- FileWatcherExtensions(const FilePath& path,
- const std::string& extension_id) {
- file_watcher.reset(new base::files::FilePathWatcher());
- virtual_path = path;
- extensions.insert(extension_id);
- }
- ~FileWatcherExtensions() {}
- linked_ptr<base::files::FilePathWatcher> file_watcher;
- FilePath local_path;
- FilePath virtual_path;
- std::set<std::string> extensions;
- } FileWatcherProcess;
- typedef std::map<FilePath, FileWatcherExtensions*> WatcherMap;
-
// Helper class for passing through file watch notification events.
class FileWatcherDelegate : public base::files::FilePathWatcher::Delegate {
public:
@@ -78,6 +63,37 @@ class ExtensionFileBrowserEventRouter
ExtensionFileBrowserEventRouter* router_;
};
+ typedef std::map<std::string, int> ExtensionUsageRegistry;
+
+ class FileWatcherExtensions {
+ public:
+ FileWatcherExtensions(const FilePath& path,
+ const std::string& extension_id);
+
+ ~FileWatcherExtensions() {}
+
+ void AddExtension(const std::string& extension_id);
+
+ void RemoveExtension(const std::string& extension_id);
+
+ const ExtensionUsageRegistry& GetExtensions() const;
+
+ unsigned int GetRefCount() const;
+
+ const FilePath& GetVirtualPath() const;
+
+ bool Watch(const FilePath& path, FileWatcherDelegate* delegate);
+
+ private:
+ linked_ptr<base::files::FilePathWatcher> file_watcher;
+ FilePath local_path;
+ FilePath virtual_path;
+ ExtensionUsageRegistry extensions;
+ unsigned int ref_count;
+ };
+
+ typedef std::map<FilePath, FileWatcherExtensions*> WatcherMap;
+
// USB mount event handlers.
void OnDiskAdded(const chromeos::MountLibrary::Disk* disk);
void OnDiskRemoved(const chromeos::MountLibrary::Disk* disk);
@@ -95,7 +111,7 @@ class ExtensionFileBrowserEventRouter
// Sends folder change event.
void DispatchFolderChangeEvent(const FilePath& path, bool error,
- const std::set<std::string>& extensions);
+ const ExtensionUsageRegistry& extensions);
// Sends filesystem changed extension message to all renderers.
void DispatchDiskEvent(const chromeos::MountLibrary::Disk* disk, bool added);
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/file_browser_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698