jni_onload.cc 939 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright 2019 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 "content/public/app/content_jni_onload.h"
  5. #include "content/public/app/content_main.h"
  6. #include "weblayer/app/content_main_delegate_impl.h"
  7. namespace weblayer {
  8. class MainDelegateImpl : public MainDelegate {
  9. public:
  10. void PreMainMessageLoopRun() override {}
  11. void PostMainMessageLoopRun() override {}
  12. void SetMainMessageLoopQuitClosure(base::OnceClosure quit_closure) override {}
  13. };
  14. // This is called by the VM when the shared library is first loaded.
  15. bool OnJNIOnLoadInit() {
  16. if (!content::android::OnJNIOnLoadInit())
  17. return false;
  18. weblayer::MainParams params;
  19. params.delegate = new weblayer::MainDelegateImpl;
  20. content::SetContentMainDelegate(
  21. new weblayer::ContentMainDelegateImpl(params));
  22. return true;
  23. }
  24. } // namespace weblayer