test_native_handler.cc 935 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2015 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. #include "extensions/renderer/test_native_handler.h"
  5. #include "base/bind.h"
  6. #include "extensions/renderer/wake_event_page.h"
  7. #include "v8/include/v8-function.h"
  8. namespace extensions {
  9. TestNativeHandler::TestNativeHandler(ScriptContext* context)
  10. : ObjectBackedNativeHandler(context) {}
  11. void TestNativeHandler::AddRoutes() {
  12. RouteHandlerFunction("GetWakeEventPage", "test",
  13. base::BindRepeating(&TestNativeHandler::GetWakeEventPage,
  14. base::Unretained(this)));
  15. }
  16. void TestNativeHandler::GetWakeEventPage(
  17. const v8::FunctionCallbackInfo<v8::Value>& args) {
  18. CHECK_EQ(0, args.Length());
  19. args.GetReturnValue().Set(WakeEventPage::Get()->GetForContext(context()));
  20. }
  21. } // namespace extensions