dom_hooks_delegate.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2020 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. #ifndef EXTENSIONS_RENDERER_DOM_HOOKS_DELEGATE_H_
  5. #define EXTENSIONS_RENDERER_DOM_HOOKS_DELEGATE_H_
  6. #include <string>
  7. #include "extensions/renderer/bindings/api_binding_hooks_delegate.h"
  8. #include "v8/include/v8-forward.h"
  9. namespace extensions {
  10. class ScriptContext;
  11. // The custom hooks for the chrome.dom API.
  12. class DOMHooksDelegate : public APIBindingHooksDelegate {
  13. public:
  14. DOMHooksDelegate();
  15. ~DOMHooksDelegate() override;
  16. DOMHooksDelegate(const DOMHooksDelegate&) = delete;
  17. DOMHooksDelegate& operator=(const DOMHooksDelegate&) = delete;
  18. // APIBindingHooksDelegate:
  19. APIBindingHooks::RequestResult HandleRequest(
  20. const std::string& method_name,
  21. const APISignature* signature,
  22. v8::Local<v8::Context> context,
  23. std::vector<v8::Local<v8::Value>>* arguments,
  24. const APITypeReferenceMap& refs) override;
  25. private:
  26. v8::Local<v8::Value> OpenOrClosedShadowRoot(
  27. ScriptContext* script_context,
  28. const std::vector<v8::Local<v8::Value>>& parsed_arguments);
  29. };
  30. } // namespace extensions
  31. #endif // EXTENSIONS_RENDERER_DOM_HOOKS_DELEGATE_H_