web_request_hooks.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #ifndef EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_
  5. #define EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_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. // Custom hooks for the WebRequest API.
  11. class WebRequestHooks : public APIBindingHooksDelegate {
  12. public:
  13. WebRequestHooks();
  14. WebRequestHooks(const WebRequestHooks&) = delete;
  15. WebRequestHooks& operator=(const WebRequestHooks&) = delete;
  16. ~WebRequestHooks() override;
  17. // APIBindingHooksDelegate:
  18. // Creates a new WebRequest event.
  19. // TODO(devlin): WebRequest events are a very unfortunate implementation
  20. // detail, but refactoring means changing a few parts of the internal API.
  21. // It's not impossible, but it's a bit involved. However, as we move more
  22. // towards native bindings, it's definitely something we'll want to do.
  23. bool CreateCustomEvent(v8::Local<v8::Context> context,
  24. const std::string& event_name,
  25. v8::Local<v8::Value>* event_out) override;
  26. };
  27. } // namespace extensions
  28. #endif // EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_