Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: extensions/renderer/api_binding_hooks.cc

Issue 2552343006: [Extensions Binding] Allow for registering custom hooks (Closed)
Patch Set: polish Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698