| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/common/extensions/manifest_handler.h" | 5 #include "chrome/common/extensions/manifest_handler.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool ManifestHandlerRegistry::ParseExtension(Extension* extension, | 36 bool ManifestHandlerRegistry::ParseExtension(Extension* extension, |
| 37 string16* error) { | 37 string16* error) { |
| 38 std::set<ManifestHandler*> handler_set; | 38 std::set<ManifestHandler*> handler_set; |
| 39 for (ManifestHandlerMap::iterator iter = handlers_.begin(); | 39 for (ManifestHandlerMap::iterator iter = handlers_.begin(); |
| 40 iter != handlers_.end(); ++iter) { | 40 iter != handlers_.end(); ++iter) { |
| 41 ManifestHandler* handler = iter->second.get(); | 41 ManifestHandler* handler = iter->second.get(); |
| 42 if (extension->manifest()->HasPath(iter->first) || | 42 if (extension->manifest()->HasPath(iter->first) || |
| 43 handler->AlwaysParseForType(extension->GetType())) | 43 handler->AlwaysParseForType(extension->GetType())) |
| 44 handler_set.insert(iter->second.get()); | 44 handler_set.insert(handler); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // TODO(yoz): Some handlers may depend on other handlers having already | 47 // TODO(yoz): Some handlers may depend on other handlers having already |
| 48 // parsed their keys. Reorder the handlers so that handlers needed earlier | 48 // parsed their keys. Reorder the handlers so that handlers needed earlier |
| 49 // come first in the returned container. | 49 // come first in the returned container. |
| 50 for (std::set<ManifestHandler*>::iterator iter = handler_set.begin(); | 50 for (std::set<ManifestHandler*>::iterator iter = handler_set.begin(); |
| 51 iter != handler_set.end(); ++iter) { | 51 iter != handler_set.end(); ++iter) { |
| 52 if (!(*iter)->Parse(extension, error)) | 52 if (!(*iter)->Parse(extension, error)) |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 75 ManifestHandler* handler) { | 75 ManifestHandler* handler) { |
| 76 g_registry.Get().RegisterManifestHandler(key, handler); | 76 g_registry.Get().RegisterManifestHandler(key, handler); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // static | 79 // static |
| 80 bool ManifestHandler::ParseExtension(Extension* extension, string16* error) { | 80 bool ManifestHandler::ParseExtension(Extension* extension, string16* error) { |
| 81 return g_registry.Get().ParseExtension(extension, error); | 81 return g_registry.Get().ParseExtension(extension, error); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace extensions | 84 } // namespace extensions |
| OLD | NEW |