| Index: chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_util.cc
|
| diff --git a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_util.cc b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_util.cc
|
| index b13ff288099efa2df6610b62d851f0fa833dd9b5..430759e1209e5648ec111a5b7d80f5a272c37b0f 100644
|
| --- a/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_util.cc
|
| +++ b/chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner_util.cc
|
| @@ -7,7 +7,6 @@
|
| #include <utility>
|
| #include <vector>
|
|
|
| -#include "chrome/browser/chromeos/arc/fileapi/arc_file_system_operation_runner.h"
|
| #include "components/arc/arc_service_manager.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "url/gurl.h"
|
| @@ -77,6 +76,32 @@ void GetChildDocumentsOnUIThread(const std::string& authority,
|
| runner->GetChildDocuments(authority, parent_document_id, callback);
|
| }
|
|
|
| +void AddWatcherOnUIThread(const std::string& authority,
|
| + const std::string& document_id,
|
| + const WatcherCallback& watcher_callback,
|
| + const AddWatcherCallback& callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| + auto* runner =
|
| + ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
|
| + if (!runner) {
|
| + callback.Run(-1);
|
| + return;
|
| + }
|
| + runner->AddWatcher(authority, document_id, watcher_callback, callback);
|
| +}
|
| +
|
| +void RemoveWatcherOnUIThread(int64_t watcher_id,
|
| + const RemoveWatcherCallback& callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| + auto* runner =
|
| + ArcServiceManager::GetGlobalService<ArcFileSystemOperationRunner>();
|
| + if (!runner) {
|
| + callback.Run(false);
|
| + return;
|
| + }
|
| + runner->RemoveWatcher(watcher_id, callback);
|
| +}
|
| +
|
| } // namespace
|
|
|
| void GetFileSizeOnIOThread(const GURL& url,
|
| @@ -120,6 +145,29 @@ void GetChildDocumentsOnIOThread(const std::string& authority,
|
| callback)));
|
| }
|
|
|
| +void AddWatcherOnIOThread(const std::string& authority,
|
| + const std::string& document_id,
|
| + const WatcherCallback& watcher_callback,
|
| + const AddWatcherCallback& callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI, FROM_HERE,
|
| + base::Bind(
|
| + &AddWatcherOnUIThread, authority, document_id,
|
| + base::Bind(&PostToIOThread<ArcFileSystemOperationRunner::ChangeType>,
|
| + watcher_callback),
|
| + base::Bind(&PostToIOThread<int64_t>, callback)));
|
| +}
|
| +
|
| +void RemoveWatcherOnIOThread(int64_t watcher_id,
|
| + const RemoveWatcherCallback& callback) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI, FROM_HERE,
|
| + base::Bind(&RemoveWatcherOnUIThread, watcher_id,
|
| + base::Bind(&PostToIOThread<bool>, callback)));
|
| +}
|
| +
|
| } // namespace file_system_operation_runner_util
|
|
|
| } // namespace arc
|
|
|