Chromium Code Reviews| Index: chrome/browser/extensions/component_loader.cc |
| diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc |
| index 6cf7f5534409073d9fecc7aa2c1cd851c3a0f5a6..9f25a1245d29b5c31b22d06d4e17cd0598785d4c 100644 |
| --- a/chrome/browser/extensions/component_loader.cc |
| +++ b/chrome/browser/extensions/component_loader.cc |
| @@ -64,9 +64,9 @@ void ComponentLoader::LoadAll() { |
| } |
| } |
| -const Extension* ComponentLoader::Add( |
| - const std::string& manifest, const FilePath& root_directory) { |
| - ComponentExtensionInfo info(manifest, root_directory); |
| +const Extension* ComponentLoader::Add(const std::string& manifest, |
| + const FilePath& root_directory, DictionaryValue* manifest_overrides) { |
| + ComponentExtensionInfo info(manifest, root_directory, manifest_overrides); |
| Register(info); |
| if (extension_service_->is_ready()) |
| return Load(info); |
| @@ -81,6 +81,13 @@ const Extension* ComponentLoader::Load(const ComponentExtensionInfo& info) { |
| return NULL; |
| } |
| + DCHECK(manifest->IsType(Value::TYPE_DICTIONARY)); |
| + |
| + if (info.manifest_overrides != NULL) { |
| + ((DictionaryValue*)manifest.get())->MergeDictionary( |
| + info.manifest_overrides); |
| + } |
| + |
| int flags = Extension::REQUIRE_KEY; |
| if (Extension::ShouldDoStrictErrorChecking(Extension::COMPONENT)) |
| flags |= Extension::STRICT_ERROR_CHECKS; |
| @@ -190,6 +197,8 @@ void ComponentLoader::AddDefaultComponentExtensions() { |
| IDR_CLOUDPRINT_MANIFEST)); |
| #endif // !defined(OS_CHROMEOS) |
| + ResourceBundle& resource_bundle = ResourceBundle::GetSharedInstance(); |
| + |
| for (ComponentExtensionList::iterator iter = component_extensions.begin(); |
| iter != component_extensions.end(); ++iter) { |
| FilePath path(iter->first); |
| @@ -201,9 +210,8 @@ void ComponentLoader::AddDefaultComponentExtensions() { |
| } |
| } |
| - std::string manifest = |
| - ResourceBundle::GetSharedInstance().GetRawDataResource( |
| - iter->second).as_string(); |
| + std::string manifest = resource_bundle.GetRawDataResource( |
| + iter->second).as_string(); |
| Add(manifest, path); |
| } |
| @@ -213,12 +221,25 @@ void ComponentLoader::AddDefaultComponentExtensions() { |
| GetBoolean(prefs::kAccessibilityEnabled)) { |
| FilePath path = FilePath(extension_misc::kAccessExtensionPath) |
| .AppendASCII(extension_misc::kChromeVoxDirectoryName); |
| - std::string manifest = |
| - ResourceBundle::GetSharedInstance().GetRawDataResource( |
| + std::string manifest = resource_bundle.GetRawDataResource( |
| IDR_CHROMEVOX_MANIFEST).as_string(); |
| Add(manifest, path); |
| } |
| #endif |
| -} |
| + if (/* policy specifies an enterprise web store */ 1) { |
| + DictionaryValue* manifest_overrides = new DictionaryValue(); // FIXME: Leak. |
| + |
| + // FIXME: Fetch the URL from the appropriate policy |
| + manifest_overrides->SetString("app.launch.web_url", "http://www.corp.google.com"); |
| + |
| + FilePath path; |
| + if (!PathService::Get(chrome::DIR_RESOURCES, &path)) |
| + NOTREACHED(); |
| + path.Append(FILE_PATH_LITERAL("enterprise_web_store")); |
| + std::string manifest = resource_bundle.GetRawDataResource( |
| + IDR_ENTERPRISE_WEBSTORE_MANIFEST).as_string(); |
| + Add(manifest, path, manifest_overrides); |
|
Aaron Boodman
2011/11/06 23:05:40
Instead of introducing this overrides thing, just
|
| + } |
| +} |
| } // namespace extensions |