| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_ | 5 #ifndef EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_ |
| 6 #define EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_ | 6 #define EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "extensions/renderer/api_binding_hooks_delegate.h" | 11 #include "extensions/renderer/bindings/api_binding_hooks_delegate.h" |
| 12 #include "extensions/renderer/api_binding_types.h" | 12 #include "extensions/renderer/bindings/api_binding_types.h" |
| 13 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 // Custom hooks for the WebRequest API. | 17 // Custom hooks for the WebRequest API. |
| 18 class WebRequestHooks : public APIBindingHooksDelegate { | 18 class WebRequestHooks : public APIBindingHooksDelegate { |
| 19 public: | 19 public: |
| 20 WebRequestHooks(); | 20 WebRequestHooks(); |
| 21 ~WebRequestHooks() override; | 21 ~WebRequestHooks() override; |
| 22 | 22 |
| 23 // APIBindingHooksDelegate: | 23 // APIBindingHooksDelegate: |
| 24 // Creates a new WebRequest event. | 24 // Creates a new WebRequest event. |
| 25 // TODO(devlin): WebRequest events are a very unfortunate implementation | 25 // TODO(devlin): WebRequest events are a very unfortunate implementation |
| 26 // detail, but refactoring means changing a few parts of the internal API. | 26 // detail, but refactoring means changing a few parts of the internal API. |
| 27 // It's not impossible, but it's a bit involved. However, as we move more | 27 // It's not impossible, but it's a bit involved. However, as we move more |
| 28 // towards native bindings, it's definitely something we'll want to do. | 28 // towards native bindings, it's definitely something we'll want to do. |
| 29 bool CreateCustomEvent(v8::Local<v8::Context> context, | 29 bool CreateCustomEvent(v8::Local<v8::Context> context, |
| 30 const binding::RunJSFunctionSync& run_js_sync, | 30 const binding::RunJSFunctionSync& run_js_sync, |
| 31 const std::string& event_name, | 31 const std::string& event_name, |
| 32 v8::Local<v8::Value>* event_out) override; | 32 v8::Local<v8::Value>* event_out) override; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 DISALLOW_COPY_AND_ASSIGN(WebRequestHooks); | 35 DISALLOW_COPY_AND_ASSIGN(WebRequestHooks); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace extensions | 38 } // namespace extensions |
| 39 | 39 |
| 40 #endif // EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_ | 40 #endif // EXTENSIONS_RENDERER_WEB_REQUEST_HOOKS_H_ |
| OLD | NEW |