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

Unified Diff: chrome/common/extensions/api/extension_api.cc

Issue 8869003: Move the "extension" namespace from extension_api.json into extension_api_extension.json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build.py again? Created 9 years 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
« no previous file with comments | « chrome/common/extensions/api/extension_api.h ('k') | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/api/extension_api.cc
diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc
index c75fb6014f83a30c969db656c1880a56c6c9998e..b13b84bca3e28b5d860306864b5ec7f16f4a0754 100644
--- a/chrome/common/extensions/api/extension_api.cc
+++ b/chrome/common/extensions/api/extension_api.cc
@@ -22,21 +22,32 @@ ExtensionAPI* ExtensionAPI::GetInstance() {
return Singleton<ExtensionAPI>::get();
}
-ExtensionAPI::ExtensionAPI() {
+static base::ListValue* LoadSchemaList(int resource_id) {
const bool kAllowTrailingCommas = false;
std::string error_message;
- scoped_ptr<Value> temp_value(
+ Value* result =
base::JSONReader::ReadAndReturnError(
ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_EXTENSION_API_JSON).as_string(),
+ resource_id).as_string(),
kAllowTrailingCommas,
NULL, // error code
- &error_message));
- CHECK(temp_value.get()) << error_message;
- CHECK(temp_value->IsType(base::Value::TYPE_LIST))
- << "Top-level node in extension API is not dictionary";
+ &error_message);
+ CHECK(result) << error_message;
+ CHECK(result->IsType(base::Value::TYPE_LIST));
+ return static_cast<base::ListValue*>(result);
+}
+
+static void AppendExtraSchemaList(base::ListValue* list, int resource_id) {
+ Value* value;
+ scoped_ptr<base::ListValue> to_append(LoadSchemaList(resource_id));
+ while (to_append->Remove(0, &value)) {
+ list->Append(value);
+ }
+}
- value_.reset(static_cast<base::ListValue*>(temp_value.release()));
+ExtensionAPI::ExtensionAPI() {
+ value_.reset(LoadSchemaList(IDR_EXTENSION_API_JSON));
+ AppendExtraSchemaList(value_.get(), IDR_EXTENSION_API_JSON_EXTENSION);
}
ExtensionAPI::~ExtensionAPI() {
« no previous file with comments | « chrome/common/extensions/api/extension_api.h ('k') | chrome/common/extensions/api/extension_api.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698