Chromium Code Reviews| 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() { |