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

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: 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
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..a8ca80c11aebaa2fa4221f945a1f9b5f5055932b 100644
--- a/chrome/common/extensions/api/extension_api.cc
+++ b/chrome/common/extensions/api/extension_api.cc
@@ -22,21 +22,24 @@ ExtensionAPI* ExtensionAPI::GetInstance() {
return Singleton<ExtensionAPI>::get();
}
-ExtensionAPI::ExtensionAPI() {
+static Value* LoadValue(int resource_id) {
not at google - send to devlin 2011/12/07 23:26:00 LoadSchema or something might be more descriptive.
koz (OOO until 15th September) 2011/12/09 19:24:18 I've changed this to be a pair of functions LoadSc
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;
+ return result;
+}
- value_.reset(static_cast<base::ListValue*>(temp_value.release()));
+ExtensionAPI::ExtensionAPI() {
+ value_.reset(
+ static_cast<base::ListValue*>(LoadValue(IDR_EXTENSION_API_JSON)));
+ value_->Append(LoadValue(IDR_EXTENSION_API_EXTENSION_JSON));
not at google - send to devlin 2011/12/07 23:26:00 It sounds awkward, but names like IDR_EXTENSION_ST
Aaron Boodman 2011/12/07 23:30:35 cute.
koz (OOO until 15th September) 2011/12/09 19:24:18 I've gone with aa's suggestion of IDR_EXTENSION_AP
}
ExtensionAPI::~ExtensionAPI() {

Powered by Google App Engine
This is Rietveld 408576698