| OLD | NEW |
| (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 #ifndef EXTENSIONS_RENDERER_API_BINDING_TYPES_H_ | |
| 6 #define EXTENSIONS_RENDERER_API_BINDING_TYPES_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "v8/include/v8.h" | |
| 13 | |
| 14 namespace extensions { | |
| 15 namespace binding { | |
| 16 | |
| 17 // A value indicating an event has no maximum listener count. | |
| 18 extern const int kNoListenerMax; | |
| 19 | |
| 20 // Types of changes for event listener registration. | |
| 21 enum class EventListenersChanged { | |
| 22 HAS_LISTENERS, // The event had no listeners, and now does. | |
| 23 NO_LISTENERS, // The event had listeners, and now does not. | |
| 24 }; | |
| 25 | |
| 26 // The browser thread that the request should be sent to. | |
| 27 enum class RequestThread { | |
| 28 UI, | |
| 29 IO, | |
| 30 }; | |
| 31 | |
| 32 // A callback to execute the given v8::Function with the provided context and | |
| 33 // arguments. | |
| 34 using RunJSFunction = base::Callback<void(v8::Local<v8::Function>, | |
| 35 v8::Local<v8::Context>, | |
| 36 int argc, | |
| 37 v8::Local<v8::Value>[])>; | |
| 38 | |
| 39 // A callback to execute the given v8::Function synchronously and return the | |
| 40 // result. Note that script can be suspended, so you need to be certain that | |
| 41 // it is not before expected a synchronous result. We use a Global instead of a | |
| 42 // Local because certain implementations need to create a persistent handle in | |
| 43 // order to prevent immediate destruction of the locals. | |
| 44 // TODO(devlin): if we could, using Local here with an EscapableHandleScope | |
| 45 // would be preferable. | |
| 46 using RunJSFunctionSync = | |
| 47 base::Callback<v8::Global<v8::Value>(v8::Local<v8::Function>, | |
| 48 v8::Local<v8::Context>, | |
| 49 int argc, | |
| 50 v8::Local<v8::Value>[])>; | |
| 51 | |
| 52 } // namespace binding | |
| 53 } // namespace extensions | |
| 54 | |
| 55 #endif // EXTENSIONS_RENDERER_API_BINDING_TYPES_H_ | |
| OLD | NEW |