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

Unified Diff: chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc

Issue 689603002: [fsp] Implement storage::WatcherManager for FSP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc
diff --git a/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc b/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..837d152adcf8fa61e72950f2a59e74ba3c8a6cb6
--- /dev/null
+++ b/chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.cc
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.h"
+
+#include "chrome/browser/chromeos/file_system_provider/mount_path_util.h"
+#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
+#include "content/public/browser/browser_thread.h"
+#include "storage/browser/fileapi/file_system_url.h"
+
+using content::BrowserThread;
+
+namespace chromeos {
+namespace file_system_provider {
+
+WatcherManager::WatcherManager() {
+}
+WatcherManager::~WatcherManager() {
+}
+
+void WatcherManager::AddWatcher(
+ const storage::FileSystemURL& url,
+ bool recursive,
+ const StatusCallback& callback,
+ const NotificationCallback& notification_callback) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ util::FileSystemURLParser parser(url);
+ if (!parser.Parse()) {
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+ return;
+ }
+
+ parser.file_system()->AddWatcher(url.origin(),
+ parser.file_path(),
+ recursive,
+ false /* persistent */,
+ callback,
+ notification_callback);
+}
+
+void WatcherManager::RemoveWatcher(const storage::FileSystemURL& url,
+ bool recursive,
+ const StatusCallback& callback) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ util::FileSystemURLParser parser(url);
+ if (!parser.Parse()) {
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+ return;
+ }
+
+ parser.file_system()->RemoveWatcher(
+ url.origin(), parser.file_path(), recursive, callback);
+}
+
+} // namespace file_system_provider
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698