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

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

Issue 2552343006: [Extensions Binding] Allow for registering custom hooks (Closed)
Patch Set: jbroman 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() {}
10 APIBindingHooks::~APIBindingHooks() {}
11
12 void APIBindingHooks::RegisterHandleRequest(const std::string& method_name,
13 const HandleRequestHook& hook) {
14 request_hooks_[method_name] = hook;
15 }
16
17 APIBindingHooks::HandleRequestHook APIBindingHooks::GetHandleRequest(
18 const std::string& method_name) {
19 auto iter = request_hooks_.find(method_name);
20 if (iter != request_hooks_.end())
21 return iter->second;
22
23 return HandleRequestHook();
24 }
25
26 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698