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

Side by Side Diff: chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr ovider_api.h" 5 #include "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr ovider_api.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h" 14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte rface.h"
15 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" 15 #include "chrome/browser/chromeos/file_system_provider/request_manager.h"
16 #include "chrome/browser/chromeos/file_system_provider/request_value.h" 16 #include "chrome/browser/chromeos/file_system_provider/request_value.h"
17 #include "chrome/browser/chromeos/file_system_provider/service.h" 17 #include "chrome/browser/chromeos/file_system_provider/service.h"
18 #include "chrome/common/extensions/api/file_system_provider.h" 18 #include "chrome/common/extensions/api/file_system_provider.h"
19 #include "chrome/common/extensions/api/file_system_provider_internal.h" 19 #include "chrome/common/extensions/api/file_system_provider_internal.h"
20 #include "storage/browser/fileapi/watcher_manager.h"
20 21
21 using chromeos::file_system_provider::MountOptions; 22 using chromeos::file_system_provider::MountOptions;
22 using chromeos::file_system_provider::ProvidedFileSystemInfo; 23 using chromeos::file_system_provider::ProvidedFileSystemInfo;
23 using chromeos::file_system_provider::ProvidedFileSystemInterface; 24 using chromeos::file_system_provider::ProvidedFileSystemInterface;
24 using chromeos::file_system_provider::ProvidedFileSystemObserver; 25 using chromeos::file_system_provider::ProvidedFileSystemObserver;
25 using chromeos::file_system_provider::RequestValue; 26 using chromeos::file_system_provider::RequestValue;
26 using chromeos::file_system_provider::Service; 27 using chromeos::file_system_provider::Service;
27 28
28 namespace extensions { 29 namespace extensions {
29 namespace { 30 namespace {
30 31
31 typedef std::vector<linked_ptr<api::file_system_provider::Change>> IDLChanges; 32 typedef std::vector<linked_ptr<api::file_system_provider::Change>> IDLChanges;
32 33
33 const char kNotifyFailedErrorMessage[] = 34 const char kNotifyFailedErrorMessage[] =
34 "Sending a response for the request failed."; 35 "Sending a response for the request failed.";
35 const char kInvalidNotificationErrorMessage[] = "The notification is invalid."; 36 const char kInvalidNotificationErrorMessage[] = "The notification is invalid.";
36 37
37 // Converts the change type from the IDL type to a native type. |changed_type| 38 // Converts the change type from the IDL type to a native type. |changed_type|
38 // must be specified (not CHANGE_TYPE_NONE). 39 // must be specified (not CHANGE_TYPE_NONE).
39 ProvidedFileSystemObserver::ChangeType ParseChangeType( 40 storage::WatcherManager::ChangeType ParseChangeType(
40 const api::file_system_provider::ChangeType& change_type) { 41 const api::file_system_provider::ChangeType& change_type) {
41 switch (change_type) { 42 switch (change_type) {
42 case api::file_system_provider::CHANGE_TYPE_CHANGED: 43 case api::file_system_provider::CHANGE_TYPE_CHANGED:
43 return ProvidedFileSystemObserver::CHANGED; 44 return storage::WatcherManager::CHANGED;
44 case api::file_system_provider::CHANGE_TYPE_DELETED: 45 case api::file_system_provider::CHANGE_TYPE_DELETED:
45 return ProvidedFileSystemObserver::DELETED; 46 return storage::WatcherManager::DELETED;
46 default: 47 default:
47 break; 48 break;
48 } 49 }
49 NOTREACHED(); 50 NOTREACHED();
50 return ProvidedFileSystemObserver::CHANGED; 51 return storage::WatcherManager::CHANGED;
51 } 52 }
52 53
53 // Convert the change from the IDL type to a native type. The reason IDL types 54 // Convert the change from the IDL type to a native type. The reason IDL types
54 // are not used is since they are imperfect, eg. paths are stored as strings. 55 // are not used is since they are imperfect, eg. paths are stored as strings.
55 ProvidedFileSystemObserver::Change ParseChange( 56 ProvidedFileSystemObserver::Change ParseChange(
56 const api::file_system_provider::Change& change) { 57 const api::file_system_provider::Change& change) {
57 ProvidedFileSystemObserver::Change result; 58 ProvidedFileSystemObserver::Change result;
58 result.entry_path = base::FilePath::FromUTF8Unsafe(change.entry_path); 59 result.entry_path = base::FilePath::FromUTF8Unsafe(change.entry_path);
59 result.change_type = ParseChangeType(change.change_type); 60 result.change_type = ParseChangeType(change.change_type);
60 return result; 61 return result;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 using api::file_system_provider_internal::OperationRequestedError::Params; 274 using api::file_system_provider_internal::OperationRequestedError::Params;
274 scoped_ptr<Params> params(Params::Create(*args_)); 275 scoped_ptr<Params> params(Params::Create(*args_));
275 EXTENSION_FUNCTION_VALIDATE(params); 276 EXTENSION_FUNCTION_VALIDATE(params);
276 277
277 const base::File::Error error = ProviderErrorToFileError(params->error); 278 const base::File::Error error = ProviderErrorToFileError(params->error);
278 RejectRequest(RequestValue::CreateForOperationError(params.Pass()), error); 279 RejectRequest(RequestValue::CreateForOperationError(params.Pass()), error);
279 return true; 280 return true;
280 } 281 }
281 282
282 } // namespace extensions 283 } // namespace extensions
OLDNEW
« 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