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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/file_system_provider/fileapi/watcher_manager.h "
6
7 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h"
8 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
9 #include "content/public/browser/browser_thread.h"
10 #include "storage/browser/fileapi/file_system_url.h"
11
12 using content::BrowserThread;
13
14 namespace chromeos {
15 namespace file_system_provider {
16
17 WatcherManager::WatcherManager() {
18 }
19 WatcherManager::~WatcherManager() {
20 }
21
22 void WatcherManager::AddWatcher(
23 const storage::FileSystemURL& url,
24 bool recursive,
25 const StatusCallback& callback,
26 const NotificationCallback& notification_callback) {
27 DCHECK_CURRENTLY_ON(BrowserThread::UI);
28
29 util::FileSystemURLParser parser(url);
30 if (!parser.Parse()) {
31 callback.Run(base::File::FILE_ERROR_SECURITY);
32 return;
33 }
34
35 parser.file_system()->AddWatcher(url.origin(),
36 parser.file_path(),
37 recursive,
38 false /* persistent */,
39 callback,
40 notification_callback);
41 }
42
43 void WatcherManager::RemoveWatcher(const storage::FileSystemURL& url,
44 bool recursive,
45 const StatusCallback& callback) {
46 DCHECK_CURRENTLY_ON(BrowserThread::UI);
47
48 util::FileSystemURLParser parser(url);
49 if (!parser.Parse()) {
50 callback.Run(base::File::FILE_ERROR_SECURITY);
51 return;
52 }
53
54 parser.file_system()->RemoveWatcher(
55 url.origin(), parser.file_path(), recursive, callback);
56 }
57
58 } // namespace file_system_provider
59 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698