| Index: extensions/renderer/api_binding_hooks.cc
|
| diff --git a/extensions/renderer/api_binding_hooks.cc b/extensions/renderer/api_binding_hooks.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..98d0c72badadd4064ada05211d2f790c23594cfb
|
| --- /dev/null
|
| +++ b/extensions/renderer/api_binding_hooks.cc
|
| @@ -0,0 +1,28 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "extensions/renderer/api_binding_hooks.h"
|
| +
|
| +namespace extensions {
|
| +
|
| +APIBindingHooks::APIBindingHooks() {}
|
| +APIBindingHooks::~APIBindingHooks() {}
|
| +
|
| +void APIBindingHooks::RegisterHandleRequest(const std::string& method_name,
|
| + const HandleRequestHook& hook) {
|
| + DCHECK(!hooks_used_) << "Hooks must be registered before the first use!";
|
| + request_hooks_[method_name] = hook;
|
| +}
|
| +
|
| +APIBindingHooks::HandleRequestHook APIBindingHooks::GetHandleRequest(
|
| + const std::string& method_name) {
|
| + hooks_used_ = true;
|
| + auto iter = request_hooks_.find(method_name);
|
| + if (iter != request_hooks_.end())
|
| + return iter->second;
|
| +
|
| + return HandleRequestHook();
|
| +}
|
| +
|
| +} // namespace extensions
|
|
|