Index: chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc |
diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc |
index e8fafd7a408e200fda0571cb05feca3f1e2da6da..384e38778aee7694766e3153b864ba7d7022bf38 100644 |
--- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc |
+++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc |
@@ -24,6 +24,12 @@ using chromeos::file_system_provider::RequestValue; |
using chromeos::file_system_provider::Service; |
namespace extensions { |
+namespace { |
+ |
+const char kNotifyFailedErrorMessage[] = |
+ "Sending a response for the request failed."; |
+ |
+} // namespace |
bool FileSystemProviderMountFunction::RunSync() { |
using api::file_system_provider::Mount::Params; |
@@ -116,6 +122,41 @@ bool FileSystemProviderGetAllFunction::RunSync() { |
return true; |
} |
+bool FileSystemProviderNotifyFunction::RunSync() { |
+ using api::file_system_provider::Notify::Params; |
+ scoped_ptr<Params> params(Params::Create(*args_)); |
+ EXTENSION_FUNCTION_VALIDATE(params); |
+ |
+ Service* const service = Service::Get(GetProfile()); |
+ DCHECK(service); |
+ if (!service) |
+ return false; |
+ |
+ ProvidedFileSystemInterface* const file_system = |
+ service->GetProvidedFileSystem(extension_id(), |
+ params->options.file_system_id); |
+ if (!file_system) { |
+ base::ListValue* const result = new base::ListValue(); |
+ result->Append(CreateError(kNotFoundErrorName, kNotifyFailedErrorMessage)); |
+ SetResult(result); |
+ return true; |
+ } |
+ |
+ FOR_EACH_OBSERVER( |
+ chromeos::file_system_provider::ProvidedFileSystemInterface::Observer, |
+ *file_system->GetObservers(), |
+ OnEntryChanged( |
+ base::FilePath::FromUTF8Unsafe(params->options.observed_path), |
+ chromeos::file_system_provider::ProvidedFileSystemInterface:: |
+ CHANGED /* TODO(mtomasz) */, |
+ chromeos::file_system_provider::ProvidedFileSystemInterface:: |
+ ChildChanges())); |
+ |
+ base::ListValue* const result = new base::ListValue(); |
+ SetResult(result); |
+ return true; |
+} |
+ |
bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() { |
using api::file_system_provider_internal::UnmountRequestedSuccess::Params; |
scoped_ptr<Params> params(Params::Create(*args_)); |