OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/component_loader.h" | 5 #include "chrome/browser/extensions/component_loader.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/json/json_value_serializer.h" | 10 #include "base/json/json_value_serializer.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (!manifest.get()) { | 118 if (!manifest.get()) { |
119 LOG(ERROR) << "Could not load extension from '" << | 119 LOG(ERROR) << "Could not load extension from '" << |
120 absolute_path.value() << "'. " << error; | 120 absolute_path.value() << "'. " << error; |
121 return NULL; | 121 return NULL; |
122 } | 122 } |
123 Remove(GenerateId(manifest.get())); | 123 Remove(GenerateId(manifest.get())); |
124 | 124 |
125 return Add(manifest.release(), absolute_path); | 125 return Add(manifest.release(), absolute_path); |
126 } | 126 } |
127 | 127 |
| 128 void ComponentLoader::Reload(const std::string& extension_id) { |
| 129 for (RegisteredComponentExtensions::iterator it = |
| 130 component_extensions_.begin(); it != component_extensions_.end(); |
| 131 ++it) { |
| 132 if (GenerateId(it->manifest) == extension_id) { |
| 133 Load(*it); |
| 134 break; |
| 135 } |
| 136 } |
| 137 } |
| 138 |
128 const Extension* ComponentLoader::Load(const ComponentExtensionInfo& info) { | 139 const Extension* ComponentLoader::Load(const ComponentExtensionInfo& info) { |
129 int flags = Extension::REQUIRE_KEY; | 140 int flags = Extension::REQUIRE_KEY; |
130 // TODO(abarth): We should REQUIRE_MODERN_MANIFEST_VERSION once we've updated | 141 // TODO(abarth): We should REQUIRE_MODERN_MANIFEST_VERSION once we've updated |
131 // our component extensions to the new manifest version. | 142 // our component extensions to the new manifest version. |
132 if (Extension::ShouldDoStrictErrorChecking(Extension::COMPONENT)) | 143 if (Extension::ShouldDoStrictErrorChecking(Extension::COMPONENT)) |
133 flags |= Extension::STRICT_ERROR_CHECKS; | 144 flags |= Extension::STRICT_ERROR_CHECKS; |
134 std::string error; | 145 std::string error; |
135 | 146 |
136 // Get the absolute path to the extension. | 147 // Get the absolute path to the extension. |
137 FilePath absolute_path(info.root_directory); | 148 FilePath absolute_path(info.root_directory); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { | 332 void ComponentLoader::RegisterUserPrefs(PrefService* prefs) { |
322 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, | 333 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreURL, |
323 std::string() /* default_value */, | 334 std::string() /* default_value */, |
324 PrefService::UNSYNCABLE_PREF); | 335 PrefService::UNSYNCABLE_PREF); |
325 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, | 336 prefs->RegisterStringPref(prefs::kEnterpriseWebStoreName, |
326 std::string() /* default_value */, | 337 std::string() /* default_value */, |
327 PrefService::UNSYNCABLE_PREF); | 338 PrefService::UNSYNCABLE_PREF); |
328 } | 339 } |
329 | 340 |
330 } // namespace extensions | 341 } // namespace extensions |
OLD | NEW |