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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/file_system_provider/service.h" | 10 #include "chrome/browser/chromeos/file_system_provider/service.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunImpl() { | 177 bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunImpl() { |
178 using api::file_system_provider_internal::UnmountRequestedError::Params; | 178 using api::file_system_provider_internal::UnmountRequestedError::Params; |
179 const scoped_ptr<Params> params(Params::Create(*args_)); | 179 const scoped_ptr<Params> params(Params::Create(*args_)); |
180 EXTENSION_FUNCTION_VALIDATE(params); | 180 EXTENSION_FUNCTION_VALIDATE(params); |
181 | 181 |
182 chromeos::file_system_provider::Service* service = | 182 chromeos::file_system_provider::Service* service = |
183 chromeos::file_system_provider::Service::Get(GetProfile()); | 183 chromeos::file_system_provider::Service::Get(GetProfile()); |
184 DCHECK(service); | 184 DCHECK(service); |
185 | 185 |
186 // Currently it is not possible to refer to types/enums defined in a different | |
187 // IDL file. Therefore we need to convert DOMString to ProviderError, since | |
188 // UnmountRequestedErrorFunction() is defined in a different namespace than | |
189 // ProvidedError. | |
190 // TODO(mtomasz): Remove this trick, once IDL supports namespaces correctly. | |
191 const api::file_system_provider::ProviderError provider_error = | |
192 api::file_system_provider::ParseProviderError(params->error); | |
193 | |
194 if (!service->RejectRequest(extension_id(), | 186 if (!service->RejectRequest(extension_id(), |
195 params->file_system_id, | 187 params->file_system_id, |
196 params->request_id, | 188 params->request_id, |
197 ProviderErrorToFileError(provider_error))) { | 189 ProviderErrorToFileError(params->error))) { |
198 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. | 190 // TODO(mtomasz): Pass more detailed errors, rather than just a bool. |
199 base::ListValue* result = new base::ListValue(); | 191 base::ListValue* result = new base::ListValue(); |
200 result->Append( | 192 result->Append( |
201 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); | 193 CreateError(kSecurityErrorName, kResponseFailedErrorMessage)); |
202 SetResult(result); | 194 SetResult(result); |
203 return false; | 195 return false; |
204 } | 196 } |
205 | 197 |
206 base::ListValue* result = new base::ListValue(); | 198 base::ListValue* result = new base::ListValue(); |
207 SetResult(result); | 199 SetResult(result); |
208 SendResponse(true); | 200 SendResponse(true); |
209 return true; | 201 return true; |
210 } | 202 } |
211 | 203 |
212 } // namespace extensions | 204 } // namespace extensions |
OLD | NEW |