OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/extensions/api/file_system_provider/file_system_provide
r_api.h" |
| 6 |
| 7 #include "chrome/common/extensions/api/file_system_provider.h" |
| 8 |
| 9 namespace extensions { |
| 10 |
| 11 namespace { |
| 12 |
| 13 const char kOK[] = "OK"; |
| 14 |
| 15 // Names come from http://www.w3.org/TR/file-system-api/#errors-and-exceptions |
| 16 // TODO(satorux): Switch to DOMError once crbug.com/313131 is fixed. |
| 17 const char kEncodingError[] = "EncodingError"; |
| 18 const char kInvalidModificationError[] = "InvalidModificationError"; |
| 19 const char kInvalidStateError[] = "InvalidStateError"; |
| 20 const char kNotFoundError[] = "NotFoundError"; |
| 21 const char kNotReadableErr[] = "NotReadableErr"; |
| 22 const char kNoModificationAllowedError[] = "NoModificationAllowedError"; |
| 23 const char kPathExistsError[] = "PathExistsError"; |
| 24 const char kQuotaExceededError[] = "QuotaExceededError"; |
| 25 const char kSecurityError[] = "SecurityError"; |
| 26 const char kTypeMismatchError[] = "TypeMismatchError"; |
| 27 |
| 28 } // namespace |
| 29 |
| 30 bool FileSystemProviderMountFunction::RunImpl() { |
| 31 using extensions::api::file_system_provider::Mount::Params; |
| 32 const scoped_ptr<Params> params(Params::Create(*args_)); |
| 33 EXTENSION_FUNCTION_VALIDATE(params); |
| 34 |
| 35 // It's an error if the display name is empty. |
| 36 if (params->display_name.empty()) { |
| 37 extensions::api::file_system_provider::Error error; |
| 38 error.name = kSecurityError; |
| 39 error.message = "Empty display name is not allowed"; |
| 40 |
| 41 results_ = extensions::api::file_system_provider::Mount::Results::Create( |
| 42 error, ""); |
| 43 SendResponse(true); |
| 44 return true; |
| 45 } |
| 46 |
| 47 extensions::api::file_system_provider::Error error; |
| 48 error.name = kOK; |
| 49 // TODO(satorux): Implement the real logic. |
| 50 const std::string file_system_id = params->display_name; |
| 51 results_ = extensions::api::file_system_provider::Mount::Results::Create( |
| 52 error, file_system_id); |
| 53 SendResponse(true); |
| 54 |
| 55 return true; |
| 56 } |
| 57 |
| 58 } // namespace extensions |
OLD | NEW |