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

Unified Diff: chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc

Issue 679573002: [fsp] Separate recursive and non-recursive watchers. (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/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 e3fe876b372fb203802c209bbcebbe789c11961a..2e3b0e436c081058a30279b974ab6a4161091fff 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
@@ -28,8 +28,7 @@ using chromeos::file_system_provider::Service;
namespace extensions {
namespace {
-typedef std::vector<linked_ptr<api::file_system_provider::ChildChange>>
- IDLChildChanges;
+typedef std::vector<linked_ptr<api::file_system_provider::Change>> IDLChanges;
const char kNotifyFailedErrorMessage[] =
"Sending a response for the request failed.";
@@ -51,26 +50,25 @@ ProvidedFileSystemObserver::ChangeType ParseChangeType(
return ProvidedFileSystemObserver::CHANGED;
}
-// Convert the child change from the IDL type to a native type. The reason IDL
-// types are not used is since they are imperfect, eg. paths are stored as
-// strings.
-ProvidedFileSystemObserver::ChildChange ParseChildChange(
- const api::file_system_provider::ChildChange& child_change) {
- ProvidedFileSystemObserver::ChildChange result;
+// Convert the change from the IDL type to a native type. The reason IDL types
+// are not used is since they are imperfect, eg. paths are stored as strings.
+ProvidedFileSystemObserver::Change ParseChange(
+ const api::file_system_provider::Change& child_change) {
hirono 2014/10/24 06:58:43 nit: child_change -> change
mtomasz 2014/10/24 09:50:24 Done.
+ ProvidedFileSystemObserver::Change result;
result.entry_path = base::FilePath::FromUTF8Unsafe(child_change.entry_path);
result.change_type = ParseChangeType(child_change.change_type);
return result;
}
// Converts a list of child changes from the IDL type to a native type.
-scoped_ptr<ProvidedFileSystemObserver::ChildChanges> ParseChildChanges(
- const IDLChildChanges& child_changes) {
- scoped_ptr<ProvidedFileSystemObserver::ChildChanges> results(
- new ProvidedFileSystemObserver::ChildChanges);
- for (IDLChildChanges::const_iterator it = child_changes.begin();
+scoped_ptr<ProvidedFileSystemObserver::Changes> ParseChanges(
+ const IDLChanges& child_changes) {
hirono 2014/10/24 06:58:42 nit: child_changes -> changes
mtomasz 2014/10/24 09:50:24 Done.
+ scoped_ptr<ProvidedFileSystemObserver::Changes> results(
+ new ProvidedFileSystemObserver::Changes);
+ for (IDLChanges::const_iterator it = child_changes.begin();
hirono 2014/10/24 06:58:43 nit: You can use "for (auto it : changes)". But u
mtomasz 2014/10/24 09:50:24 Right! Done.
it != child_changes.end();
++it) {
- results->push_back(ParseChildChange(*it->get()));
+ results->push_back(ParseChange(*it->get()));
}
return results;
}
@@ -195,10 +193,11 @@ bool FileSystemProviderNotifyFunction::RunSync() {
if (!file_system->Notify(
base::FilePath::FromUTF8Unsafe(params->options.observed_path),
+ params->options.recursive,
ParseChangeType(params->options.change_type),
- params->options.child_changes.get()
- ? ParseChildChanges(*params->options.child_changes.get())
- : make_scoped_ptr(new ProvidedFileSystemObserver::ChildChanges),
+ params->options.changes.get()
+ ? ParseChanges(*params->options.changes.get())
+ : make_scoped_ptr(new ProvidedFileSystemObserver::Changes),
params->options.tag.get() ? *params->options.tag.get() : "")) {
base::ListValue* const result = new base::ListValue();
result->Append(

Powered by Google App Engine
This is Rietveld 408576698