Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3314)

Unified Diff: chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc

Issue 47513018: Make the internal storage of policy::Schemas ref counted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-4-new-generate
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
diff --git a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
index ed4edeeb15f55d98b1027e2f64f1090f4b29f2a2..99d6bbf7e50011dd909709ca0039a85e2eb52335 100644
--- a/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
+++ b/chrome/common/extensions/api/storage/storage_schema_manifest_handler.cc
@@ -33,13 +33,13 @@ StorageSchemaManifestHandler::~StorageSchemaManifestHandler() {}
#if defined(ENABLE_CONFIGURATION_POLICY)
// static
-scoped_ptr<policy::SchemaOwner> StorageSchemaManifestHandler::GetSchema(
+policy::Schema StorageSchemaManifestHandler::GetSchema(
const Extension* extension,
std::string* error) {
if (!extension->HasAPIPermission(APIPermission::kStorage)) {
*error = base::StringPrintf("The storage permission is required to use %s",
kStorageManagedSchema);
- return scoped_ptr<policy::SchemaOwner>();
+ return policy::Schema();
}
std::string path;
extension->manifest()->GetString(kStorageManagedSchema, &path);
@@ -47,20 +47,20 @@ scoped_ptr<policy::SchemaOwner> StorageSchemaManifestHandler::GetSchema(
if (file.IsAbsolute() || file.ReferencesParent()) {
*error = base::StringPrintf("%s must be a relative path without ..",
kStorageManagedSchema);
- return scoped_ptr<policy::SchemaOwner>();
+ return policy::Schema();
}
file = extension->path().AppendASCII(path);
if (!base::PathExists(file)) {
*error =
base::StringPrintf("File does not exist: %s", file.value().c_str());
- return scoped_ptr<policy::SchemaOwner>();
+ return policy::Schema();
}
std::string content;
if (!base::ReadFileToString(file, &content)) {
*error = base::StringPrintf("Can't read %s", file.value().c_str());
- return scoped_ptr<policy::SchemaOwner>();
+ return policy::Schema();
}
- return policy::SchemaOwner::Parse(content, error);
+ return policy::Schema::Parse(content, error);
}
#endif
@@ -80,7 +80,7 @@ bool StorageSchemaManifestHandler::Validate(
std::string* error,
std::vector<InstallWarning>* warnings) const {
#if defined(ENABLE_CONFIGURATION_POLICY)
- return !!GetSchema(extension, error);
+ return GetSchema(extension, error).valid();
#else
return true;
#endif
« no previous file with comments | « chrome/common/extensions/api/storage/storage_schema_manifest_handler.h ('k') | components/policy/core/common/schema.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698