OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 int flags = Extension::REQUIRE_KEY; | 179 int flags = Extension::REQUIRE_KEY; |
180 | 180 |
181 std::string error; | 181 std::string error; |
182 | 182 |
183 scoped_refptr<const Extension> extension(Extension::Create( | 183 scoped_refptr<const Extension> extension(Extension::Create( |
184 info.root_directory, | 184 info.root_directory, |
185 Manifest::COMPONENT, | 185 Manifest::COMPONENT, |
186 *info.manifest, | 186 *info.manifest, |
187 flags, | 187 flags, |
188 &error)); | 188 &error)); |
189 if (!extension) { | 189 if (!extension.get()) { |
190 LOG(ERROR) << error; | 190 LOG(ERROR) << error; |
191 return; | 191 return; |
192 } | 192 } |
193 | 193 |
194 CHECK_EQ(info.extension_id, extension->id()) << extension->name(); | 194 CHECK_EQ(info.extension_id, extension->id()) << extension->name(); |
195 extension_service_->AddComponentExtension(extension); | 195 extension_service_->AddComponentExtension(extension.get()); |
196 } | 196 } |
197 | 197 |
198 void ComponentLoader::RemoveAll() { | 198 void ComponentLoader::RemoveAll() { |
199 RegisteredComponentExtensions::iterator it = component_extensions_.begin(); | 199 RegisteredComponentExtensions::iterator it = component_extensions_.begin(); |
200 for (; it != component_extensions_.end(); ++it) | 200 for (; it != component_extensions_.end(); ++it) |
201 UnloadComponent(&(*it)); | 201 UnloadComponent(&(*it)); |
202 | 202 |
203 component_extensions_.clear(); | 203 component_extensions_.clear(); |
204 } | 204 } |
205 | 205 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { | 433 void ComponentLoader::UnloadComponent(ComponentExtensionInfo* component) { |
434 delete component->manifest; | 434 delete component->manifest; |
435 if (extension_service_->is_ready()) { | 435 if (extension_service_->is_ready()) { |
436 extension_service_-> | 436 extension_service_-> |
437 UnloadExtension(component->extension_id, | 437 UnloadExtension(component->extension_id, |
438 extension_misc::UNLOAD_REASON_DISABLE); | 438 extension_misc::UNLOAD_REASON_DISABLE); |
439 } | 439 } |
440 } | 440 } |
441 | 441 |
442 } // namespace extensions | 442 } // namespace extensions |
OLD | NEW |