| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_function_registry.h" | 5 #include "extensions/browser/extension_function_registry.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "extensions/browser/extension_function.h" | 8 #include "extensions/browser/extension_function.h" |
| 9 #include "extensions/browser/extensions_browser_client.h" | 9 #include "extensions/browser/extensions_browser_client.h" |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } else { | 39 } else { |
| 40 iter->second.factory_ = factory; | 40 iter->second.factory_ = factory; |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 ExtensionFunction* ExtensionFunctionRegistry::NewFunction( | 45 ExtensionFunction* ExtensionFunctionRegistry::NewFunction( |
| 46 const std::string& name) { | 46 const std::string& name) { |
| 47 FactoryMap::iterator iter = factories_.find(name); | 47 FactoryMap::iterator iter = factories_.find(name); |
| 48 if (iter == factories_.end()) { | 48 if (iter == factories_.end()) { |
| 49 return NULL; | 49 return nullptr; |
| 50 } | 50 } |
| 51 ExtensionFunction* function = iter->second.factory_(); | 51 ExtensionFunction* function = iter->second.factory_(); |
| 52 function->set_name(name); | 52 function->set_name(name); |
| 53 function->set_histogram_value(iter->second.histogram_value_); | 53 function->set_histogram_value(iter->second.histogram_value_); |
| 54 return function; | 54 return function; |
| 55 } | 55 } |
| 56 | 56 |
| 57 ExtensionFunctionRegistry::FactoryEntry::FactoryEntry() | 57 ExtensionFunctionRegistry::FactoryEntry::FactoryEntry() |
| 58 : factory_(0), histogram_value_(extensions::functions::UNKNOWN) {} | 58 : factory_(nullptr), histogram_value_(extensions::functions::UNKNOWN) { |
| 59 } |
| 59 | 60 |
| 60 ExtensionFunctionRegistry::FactoryEntry::FactoryEntry( | 61 ExtensionFunctionRegistry::FactoryEntry::FactoryEntry( |
| 61 ExtensionFunctionFactory factory, | 62 ExtensionFunctionFactory factory, |
| 62 extensions::functions::HistogramValue histogram_value) | 63 extensions::functions::HistogramValue histogram_value) |
| 63 : factory_(factory), histogram_value_(histogram_value) {} | 64 : factory_(factory), histogram_value_(histogram_value) {} |
| OLD | NEW |