api_definitions_natives.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2014 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_API_DEFINITIONS_NATIVES_H_
  5. #define EXTENSIONS_RENDERER_API_DEFINITIONS_NATIVES_H_
  6. #include "extensions/renderer/object_backed_native_handler.h"
  7. #include "v8/include/v8-forward.h"
  8. namespace extensions {
  9. class Dispatcher;
  10. class ScriptContext;
  11. // Native functions for JS to get access to the schemas for extension APIs.
  12. class ApiDefinitionsNatives : public ObjectBackedNativeHandler {
  13. public:
  14. ApiDefinitionsNatives(Dispatcher* dispatcher, ScriptContext* context);
  15. ApiDefinitionsNatives(const ApiDefinitionsNatives&) = delete;
  16. ApiDefinitionsNatives& operator=(const ApiDefinitionsNatives&) = delete;
  17. // ObjectBackedNativeHandler:
  18. void AddRoutes() override;
  19. private:
  20. // Returns the list of all schemas that are available to the calling context.
  21. void GetExtensionAPIDefinitionsForTest(
  22. const v8::FunctionCallbackInfo<v8::Value>& args);
  23. // Not owned.
  24. Dispatcher* dispatcher_;
  25. };
  26. } // namespace extensions
  27. #endif // EXTENSIONS_RENDERER_API_DEFINITIONS_NATIVES_H_