| 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
|
|
|