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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/observe_directory.cc

Issue 674413002: [fsp] Rename ObserveEntry with AddWatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/file_system_provider/operations/observe_direct ory.h"
6
7 #include <string>
8
9 #include "chrome/common/extensions/api/file_system_provider.h"
10 #include "chrome/common/extensions/api/file_system_provider_internal.h"
11
12 namespace chromeos {
13 namespace file_system_provider {
14 namespace operations {
15
16 ObserveDirectory::ObserveDirectory(
17 extensions::EventRouter* event_router,
18 const ProvidedFileSystemInfo& file_system_info,
19 const base::FilePath& directory_path,
20 bool recursive,
21 const storage::AsyncFileUtil::StatusCallback& callback)
22 : Operation(event_router, file_system_info),
23 directory_path_(directory_path),
24 recursive_(recursive),
25 callback_(callback) {
26 }
27
28 ObserveDirectory::~ObserveDirectory() {
29 }
30
31 bool ObserveDirectory::Execute(int request_id) {
32 using extensions::api::file_system_provider::ObserveDirectoryRequestedOptions;
33
34 ObserveDirectoryRequestedOptions options;
35 options.file_system_id = file_system_info_.file_system_id();
36 options.request_id = request_id;
37 options.directory_path = directory_path_.AsUTF8Unsafe();
38 options.recursive = recursive_;
39
40 return SendEvent(request_id,
41 extensions::api::file_system_provider::
42 OnObserveDirectoryRequested::kEventName,
43 extensions::api::file_system_provider::
44 OnObserveDirectoryRequested::Create(options));
45 }
46
47 void ObserveDirectory::OnSuccess(int /* request_id */,
48 scoped_ptr<RequestValue> /* result */,
49 bool has_more) {
50 callback_.Run(base::File::FILE_OK);
51 }
52
53 void ObserveDirectory::OnError(int /* request_id */,
54 scoped_ptr<RequestValue> /* result */,
55 base::File::Error error) {
56 callback_.Run(error);
57 }
58
59 } // namespace operations
60 } // namespace file_system_provider
61 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698