Chromium Code Reviews| Index: extensions/browser/extension_function_registry.cc |
| diff --git a/chrome/browser/extensions/extension_function_registry.cc b/extensions/browser/extension_function_registry.cc |
| similarity index 44% |
| rename from chrome/browser/extensions/extension_function_registry.cc |
| rename to extensions/browser/extension_function_registry.cc |
| index c8886d595ad41aca18938a1d9b66b97bdf452891..0e7c4982c5814773a43b2caa345a94ccfee38601 100644 |
| --- a/chrome/browser/extensions/extension_function_registry.cc |
| +++ b/extensions/browser/extension_function_registry.cc |
| @@ -2,13 +2,12 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/extensions/extension_function_registry.h" |
| +#include "extensions/browser/extension_function_registry.h" |
| -#include "chrome/browser/extensions/api/preference/chrome_direct_setting.h" |
| -#include "chrome/browser/extensions/api/preference/preference_api.h" |
| -#include "chrome/browser/extensions/api/runtime/runtime_api.h" |
| -#include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| -#include "chrome/common/extensions/api/generated_api.h" |
| +#include "base/memory/singleton.h" |
| +#include "extensions/browser/extension_function.h" |
| +#include "extensions/browser/extensions_browser_client.h" |
| +#include "extensions/common/api/generated_api.h" |
| // static |
| ExtensionFunctionRegistry* ExtensionFunctionRegistry::GetInstance() { |
| @@ -16,47 +15,19 @@ ExtensionFunctionRegistry* ExtensionFunctionRegistry::GetInstance() { |
| } |
| ExtensionFunctionRegistry::ExtensionFunctionRegistry() { |
| - ResetFunctions(); |
| -} |
| - |
| -ExtensionFunctionRegistry::~ExtensionFunctionRegistry() { |
| -} |
| - |
| -void ExtensionFunctionRegistry::ResetFunctions() { |
| #if defined(ENABLE_EXTENSIONS) |
|
Jeffrey Yasskin
2014/03/04 23:30:16
It's odd to have to #if this. Would extensions::Ex
James Cook
2014/03/04 23:55:06
Drive-by: I'm pretty sure ENABLE_EXTENSIONS is alw
Ken Rockot(use gerrit already)
2014/03/05 00:18:44
Oh, yeah, this sounds right to me. Done.
|
| - |
| - // Register all functions here. |
| - |
| - // WebRequest. |
| - RegisterFunction<WebRequestAddEventListener>(); |
| - RegisterFunction<WebRequestEventHandled>(); |
| - |
| - // Preferences. |
| - RegisterFunction<extensions::GetPreferenceFunction>(); |
| - RegisterFunction<extensions::SetPreferenceFunction>(); |
| - RegisterFunction<extensions::ClearPreferenceFunction>(); |
| - |
| - // Direct Preference Access for Component Extensions. |
| - RegisterFunction<extensions::chromedirectsetting::GetDirectSettingFunction>(); |
| - RegisterFunction<extensions::chromedirectsetting::SetDirectSettingFunction>(); |
| - RegisterFunction< |
| - extensions::chromedirectsetting::ClearDirectSettingFunction>(); |
| - |
| - // Runtime |
| - RegisterFunction<extensions::RuntimeGetBackgroundPageFunction>(); |
| - RegisterFunction<extensions::RuntimeSetUninstallURLFunction>(); |
| - RegisterFunction<extensions::RuntimeReloadFunction>(); |
| - RegisterFunction<extensions::RuntimeRequestUpdateCheckFunction>(); |
| - RegisterFunction<extensions::RuntimeRestartFunction>(); |
| - |
| - // Generated APIs |
| - extensions::api::GeneratedFunctionRegistry::RegisterAll(this); |
| -#endif // defined(ENABLE_EXTENSIONS) |
| + // TODO(rockot): Possibly also register generated API functions from |
| + // src/extension/common/api here once they exist. |
| + extensions::ExtensionsBrowserClient::Get() |
| + ->RegisterAdditionalExtensionFunctions(this); |
| +#endif |
| } |
| +ExtensionFunctionRegistry::~ExtensionFunctionRegistry() {} |
| + |
| void ExtensionFunctionRegistry::GetAllNames(std::vector<std::string>* names) { |
| - for (FactoryMap::iterator iter = factories_.begin(); |
| - iter != factories_.end(); ++iter) { |
| + for (FactoryMap::iterator iter = factories_.begin(); iter != factories_.end(); |
| + ++iter) { |
| names->push_back(iter->first); |
| } |
| } |
| @@ -86,11 +57,9 @@ ExtensionFunction* ExtensionFunctionRegistry::NewFunction( |
| } |
| ExtensionFunctionRegistry::FactoryEntry::FactoryEntry() |
| - : factory_(0), histogram_value_(extensions::functions::UNKNOWN) { |
| -} |
| + : factory_(0), histogram_value_(extensions::functions::UNKNOWN) {} |
| ExtensionFunctionRegistry::FactoryEntry::FactoryEntry( |
| ExtensionFunctionFactory factory, |
| extensions::functions::HistogramValue histogram_value) |
| - : factory_(factory), histogram_value_(histogram_value) { |
| -} |
| + : factory_(factory), histogram_value_(histogram_value) {} |