Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 #ifndef EXTENSIONS_RENDERER_DECLARATIVE_CONTENT_HOOKS_DELEGATE_H_ | |
| 6 #define EXTENSIONS_RENDERER_DECLARATIVE_CONTENT_HOOKS_DELEGATE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "extensions/renderer/api_binding_hooks_delegate.h" | |
| 15 #include "v8/include/v8.h" | |
| 16 | |
| 17 namespace extensions { | |
| 18 class APITypeReferenceMap; | |
| 19 class ArgumentSpec; | |
| 20 | |
| 21 // Custom hooks for the declarativeContent API. | |
| 22 class DeclarativeContentHooksDelegate : public APIBindingHooksDelegate { | |
| 23 public: | |
| 24 // The callback type for handling an API call. | |
| 25 using HandlerCallback = | |
| 26 base::Callback<void(const v8::FunctionCallbackInfo<v8::Value>&)>; | |
| 27 | |
| 28 DeclarativeContentHooksDelegate(); | |
| 29 ~DeclarativeContentHooksDelegate() override; | |
| 30 | |
| 31 void InitializeTemplate(v8::Isolate* isolate, | |
| 32 v8::Local<v8::ObjectTemplate> object_template, | |
| 33 const APITypeReferenceMap& type_refs) override; | |
| 34 | |
| 35 private: | |
| 36 void HandleCall(const ArgumentSpec* spec, | |
| 37 const APITypeReferenceMap* type_refs, | |
| 38 const std::string& type_name, | |
| 39 const v8::FunctionCallbackInfo<v8::Value>& info); | |
| 40 | |
| 41 std::vector<std::unique_ptr<HandlerCallback>> callbacks_; | |
|
jbroman
2017/05/01 20:16:40
Maybe comment why this is a vector<unique_ptr<Call
Devlin
2017/05/01 20:46:48
Done.
| |
| 42 | |
| 43 base::WeakPtrFactory<DeclarativeContentHooksDelegate> weak_factory_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(DeclarativeContentHooksDelegate); | |
| 46 }; | |
| 47 | |
| 48 } // namespace extensions | |
| 49 | |
| 50 #endif // EXTENSIONS_RENDERER_DECLARATIVE_CONTENT_HOOKS_DELEGATE_H_ | |
| OLD | NEW |