OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/file_system_provider/operations/unobserve_entr
y.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/unobserve_entr
y.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/common/extensions/api/file_system_provider.h" | 9 #include "chrome/common/extensions/api/file_system_provider.h" |
10 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 10 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 namespace file_system_provider { | 13 namespace file_system_provider { |
14 namespace operations { | 14 namespace operations { |
15 | 15 |
16 UnobserveEntry::UnobserveEntry( | 16 UnobserveEntry::UnobserveEntry( |
17 extensions::EventRouter* event_router, | 17 extensions::EventRouter* event_router, |
18 const ProvidedFileSystemInfo& file_system_info, | 18 const ProvidedFileSystemInfo& file_system_info, |
19 const base::FilePath& entry_path, | 19 const base::FilePath& entry_path, |
| 20 bool recursive, |
20 const storage::AsyncFileUtil::StatusCallback& callback) | 21 const storage::AsyncFileUtil::StatusCallback& callback) |
21 : Operation(event_router, file_system_info), | 22 : Operation(event_router, file_system_info), |
22 entry_path_(entry_path), | 23 entry_path_(entry_path), |
| 24 recursive_(recursive), |
23 callback_(callback) { | 25 callback_(callback) { |
24 } | 26 } |
25 | 27 |
26 UnobserveEntry::~UnobserveEntry() { | 28 UnobserveEntry::~UnobserveEntry() { |
27 } | 29 } |
28 | 30 |
29 bool UnobserveEntry::Execute(int request_id) { | 31 bool UnobserveEntry::Execute(int request_id) { |
30 using extensions::api::file_system_provider::UnobserveEntryRequestedOptions; | 32 using extensions::api::file_system_provider::UnobserveEntryRequestedOptions; |
31 | 33 |
32 UnobserveEntryRequestedOptions options; | 34 UnobserveEntryRequestedOptions options; |
33 options.file_system_id = file_system_info_.file_system_id(); | 35 options.file_system_id = file_system_info_.file_system_id(); |
34 options.request_id = request_id; | 36 options.request_id = request_id; |
35 options.entry_path = entry_path_.AsUTF8Unsafe(); | 37 options.entry_path = entry_path_.AsUTF8Unsafe(); |
| 38 options.recursive = recursive_; |
36 | 39 |
37 return SendEvent( | 40 return SendEvent( |
38 request_id, | 41 request_id, |
39 extensions::api::file_system_provider::OnUnobserveEntryRequested:: | 42 extensions::api::file_system_provider::OnUnobserveEntryRequested:: |
40 kEventName, | 43 kEventName, |
41 extensions::api::file_system_provider::OnUnobserveEntryRequested::Create( | 44 extensions::api::file_system_provider::OnUnobserveEntryRequested::Create( |
42 options)); | 45 options)); |
43 } | 46 } |
44 | 47 |
45 void UnobserveEntry::OnSuccess(int /* request_id */, | 48 void UnobserveEntry::OnSuccess(int /* request_id */, |
46 scoped_ptr<RequestValue> /* result */, | 49 scoped_ptr<RequestValue> /* result */, |
47 bool has_more) { | 50 bool has_more) { |
48 callback_.Run(base::File::FILE_OK); | 51 callback_.Run(base::File::FILE_OK); |
49 } | 52 } |
50 | 53 |
51 void UnobserveEntry::OnError(int /* request_id */, | 54 void UnobserveEntry::OnError(int /* request_id */, |
52 scoped_ptr<RequestValue> /* result */, | 55 scoped_ptr<RequestValue> /* result */, |
53 base::File::Error error) { | 56 base::File::Error error) { |
54 callback_.Run(error); | 57 callback_.Run(error); |
55 } | 58 } |
56 | 59 |
57 } // namespace operations | 60 } // namespace operations |
58 } // namespace file_system_provider | 61 } // namespace file_system_provider |
59 } // namespace chromeos | 62 } // namespace chromeos |
OLD | NEW |