Chromium Code Reviews| 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..de70854c5dbee2fe70cd808770250b4fb1ecfc03 |
| --- /dev/null |
| +++ b/extensions/renderer/api_binding_hooks.cc |
| @@ -0,0 +1,27 @@ |
| +// 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(const std::string& api_name) |
| + : api_name_(api_name) {} |
| +APIBindingHooks::~APIBindingHooks() {} |
| + |
| +void APIBindingHooks::RegisterHandleRequest(const std::string& method_name, |
| + const HandleRequestHook& hook) { |
| + request_hooks_[method_name] = hook; |
| +} |
| + |
| +APIBindingHooks::HandleRequestHook APIBindingHooks::GetHandleRequest( |
| + const std::string& method_name) { |
| + auto global_iter = request_hooks_.find(method_name); |
|
jbroman
2016/12/08 16:58:56
What's global about this iterator?
Devlin
2016/12/08 19:12:02
Named from when there was a per-context iter in th
|
| + if (global_iter != request_hooks_.end()) |
| + return global_iter->second; |
| + |
| + return HandleRequestHook(); |
| +} |
| + |
| +} // namespace extensions |