Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "extensions/renderer/api_binding_hooks.h" | |
| 6 | |
| 7 namespace extensions { | |
| 8 | |
| 9 APIBindingHooks::APIBindingHooks(const std::string& api_name) | |
| 10 : api_name_(api_name) {} | |
| 11 APIBindingHooks::~APIBindingHooks() {} | |
| 12 | |
| 13 void APIBindingHooks::RegisterHandleRequest(const std::string& method_name, | |
| 14 const HandleRequestHook& hook) { | |
| 15 request_hooks_[method_name] = hook; | |
| 16 } | |
| 17 | |
| 18 APIBindingHooks::HandleRequestHook APIBindingHooks::GetHandleRequest( | |
| 19 const std::string& method_name) { | |
| 20 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
| |
| 21 if (global_iter != request_hooks_.end()) | |
| 22 return global_iter->second; | |
| 23 | |
| 24 return HandleRequestHook(); | |
| 25 } | |
| 26 | |
| 27 } // namespace extensions | |
| OLD | NEW |