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

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
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..84a2521e2383d476c842d209884c98acbcc23004 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,23 @@ 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;
- result.entry_path = base::FilePath::FromUTF8Unsafe(child_change.entry_path);
- result.change_type = ParseChangeType(child_change.change_type);
+// 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& change) {
+ ProvidedFileSystemObserver::Change result;
+ result.entry_path = base::FilePath::FromUTF8Unsafe(change.entry_path);
+ result.change_type = ParseChangeType(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();
- it != child_changes.end();
- ++it) {
- results->push_back(ParseChildChange(*it->get()));
+scoped_ptr<ProvidedFileSystemObserver::Changes> ParseChanges(
+ const IDLChanges& changes) {
+ scoped_ptr<ProvidedFileSystemObserver::Changes> results(
+ new ProvidedFileSystemObserver::Changes);
+ for (const auto& change : changes) {
+ results->push_back(ParseChange(*change));
}
return results;
}
@@ -195,10 +191,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(
« no previous file with comments | « no previous file | chrome/browser/chromeos/file_system_provider/fake_provided_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698