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/common/extensions/api/storage/storage_schema_manifest_handler.h
" | 5 #include "chrome/common/extensions/api/storage/storage_schema_manifest_handler.h
" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return policy::Schema(); | 59 return policy::Schema(); |
60 } | 60 } |
61 return policy::Schema::Parse(content, error); | 61 return policy::Schema::Parse(content, error); |
62 } | 62 } |
63 #endif | 63 #endif |
64 | 64 |
65 bool StorageSchemaManifestHandler::Parse(Extension* extension, | 65 bool StorageSchemaManifestHandler::Parse(Extension* extension, |
66 base::string16* error) { | 66 base::string16* error) { |
67 std::string path; | 67 std::string path; |
68 if (!extension->manifest()->GetString(kStorageManagedSchema, &path)) { | 68 if (!extension->manifest()->GetString(kStorageManagedSchema, &path)) { |
69 *error = ASCIIToUTF16( | 69 *error = base::ASCIIToUTF16( |
70 base::StringPrintf("%s must be a string", kStorageManagedSchema)); | 70 base::StringPrintf("%s must be a string", kStorageManagedSchema)); |
71 return false; | 71 return false; |
72 } | 72 } |
73 | 73 |
74 // If an extension declares the "storage.managed_schema" key then it gets | 74 // If an extension declares the "storage.managed_schema" key then it gets |
75 // the "storage" permission implicitly. | 75 // the "storage" permission implicitly. |
76 APIPermissionSet* permission_set = | 76 APIPermissionSet* permission_set = |
77 PermissionsData::GetInitialAPIPermissions(extension); | 77 PermissionsData::GetInitialAPIPermissions(extension); |
78 permission_set->insert(APIPermission::kStorage); | 78 permission_set->insert(APIPermission::kStorage); |
79 | 79 |
80 return true; | 80 return true; |
81 } | 81 } |
82 | 82 |
83 bool StorageSchemaManifestHandler::Validate( | 83 bool StorageSchemaManifestHandler::Validate( |
84 const Extension* extension, | 84 const Extension* extension, |
85 std::string* error, | 85 std::string* error, |
86 std::vector<InstallWarning>* warnings) const { | 86 std::vector<InstallWarning>* warnings) const { |
87 #if defined(ENABLE_CONFIGURATION_POLICY) | 87 #if defined(ENABLE_CONFIGURATION_POLICY) |
88 return GetSchema(extension, error).valid(); | 88 return GetSchema(extension, error).valid(); |
89 #else | 89 #else |
90 return true; | 90 return true; |
91 #endif | 91 #endif |
92 } | 92 } |
93 | 93 |
94 const std::vector<std::string> StorageSchemaManifestHandler::Keys() const { | 94 const std::vector<std::string> StorageSchemaManifestHandler::Keys() const { |
95 return SingleKey(kStorageManagedSchema); | 95 return SingleKey(kStorageManagedSchema); |
96 } | 96 } |
97 | 97 |
98 } // namespace extensions | 98 } // namespace extensions |
OLD | NEW |