OLD | NEW |
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 "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/chromeos/file_system_provider/service.h" | 8 #include "chrome/browser/chromeos/file_system_provider/service.h" |
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" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunImpl() { | 147 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunImpl() { |
148 using api::file_system_provider_internal::UnmountRequestedSuccess::Params; | 148 using api::file_system_provider_internal::UnmountRequestedSuccess::Params; |
149 const scoped_ptr<Params> params(Params::Create(*args_)); | 149 const scoped_ptr<Params> params(Params::Create(*args_)); |
150 EXTENSION_FUNCTION_VALIDATE(params); | 150 EXTENSION_FUNCTION_VALIDATE(params); |
151 | 151 |
152 chromeos::file_system_provider::Service* service = | 152 chromeos::file_system_provider::Service* service = |
153 chromeos::file_system_provider::Service::Get(GetProfile()); | 153 chromeos::file_system_provider::Service::Get(GetProfile()); |
154 DCHECK(service); | 154 DCHECK(service); |
155 | 155 |
156 if (!service->FulfillRequest(extension_id(), | 156 if (!service->request_manager()->FulfillRequest( |
157 params->file_system_id, | 157 extension_id(), |
158 params->request_id, | 158 params->file_system_id, |
159 scoped_ptr<base::DictionaryValue>(), | 159 params->request_id, |
160 false /* has_more */)) { | 160 scoped_ptr<base::DictionaryValue>(), |
| 161 false /* has_more */)) { |
161 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. | 162 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. |
162 base::ListValue* result = new base::ListValue(); | 163 base::ListValue* result = new base::ListValue(); |
163 result->Append( | 164 result->Append( |
164 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); | 165 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); |
165 SetResult(result); | 166 SetResult(result); |
166 return false; | 167 return false; |
167 } | 168 } |
168 | 169 |
169 base::ListValue* result = new base::ListValue(); | 170 base::ListValue* result = new base::ListValue(); |
170 SetResult(result); | 171 SetResult(result); |
(...skipping 11 matching lines...) Expand all Loading... |
182 DCHECK(service); | 183 DCHECK(service); |
183 | 184 |
184 // Currently it is not possible to refer to types/enums defined in a different | 185 // Currently it is not possible to refer to types/enums defined in a different |
185 // IDL file. Therefore we need to convert DOMString to ProviderError, since | 186 // IDL file. Therefore we need to convert DOMString to ProviderError, since |
186 // UnmountRequestedErrorFunction() is defined in a different namespace than | 187 // UnmountRequestedErrorFunction() is defined in a different namespace than |
187 // ProvidedError. | 188 // ProvidedError. |
188 // TODO(mtomasz): Remove this trick, once IDL supports namespaces correctly. | 189 // TODO(mtomasz): Remove this trick, once IDL supports namespaces correctly. |
189 const api::file_system_provider::ProviderError provider_error = | 190 const api::file_system_provider::ProviderError provider_error = |
190 api::file_system_provider::ParseProviderError(params->error); | 191 api::file_system_provider::ParseProviderError(params->error); |
191 | 192 |
192 if (!service->RejectRequest(extension_id(), | 193 if (!service->request_manager()->RejectRequest( |
193 params->file_system_id, | 194 extension_id(), |
194 params->request_id, | 195 params->file_system_id, |
195 ProviderErrorToFileError(provider_error))) { | 196 params->request_id, |
| 197 ProviderErrorToFileError(provider_error))) { |
196 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. | 198 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. |
197 base::ListValue* result = new base::ListValue(); | 199 base::ListValue* result = new base::ListValue(); |
198 result->Append( | 200 result->Append( |
199 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); | 201 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); |
200 SetResult(result); | 202 SetResult(result); |
201 return false; | 203 return false; |
202 } | 204 } |
203 | 205 |
204 base::ListValue* result = new base::ListValue(); | 206 base::ListValue* result = new base::ListValue(); |
205 SetResult(result); | 207 SetResult(result); |
206 SendResponse(true); | 208 SendResponse(true); |
207 return true; | 209 return true; |
208 } | 210 } |
209 | 211 |
210 } // namespace extensions | 212 } // namespace extensions |
OLD | NEW |