error_page_callback_proxy.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. #ifndef WEBLAYER_BROWSER_ERROR_PAGE_CALLBACK_PROXY_H_
  5. #define WEBLAYER_BROWSER_ERROR_PAGE_CALLBACK_PROXY_H_
  6. #include <jni.h>
  7. #include "base/android/scoped_java_ref.h"
  8. #include "base/memory/raw_ptr.h"
  9. #include "weblayer/public/error_page_delegate.h"
  10. namespace weblayer {
  11. class Tab;
  12. // ErrorPageCallbackProxy forwards all ErrorPageDelegate functions to the Java
  13. // side. There is one ErrorPageCallbackProxy per Tab.
  14. class ErrorPageCallbackProxy : public ErrorPageDelegate {
  15. public:
  16. ErrorPageCallbackProxy(JNIEnv* env, jobject obj, Tab* tab);
  17. ErrorPageCallbackProxy(const ErrorPageCallbackProxy&) = delete;
  18. ErrorPageCallbackProxy& operator=(const ErrorPageCallbackProxy&) = delete;
  19. ~ErrorPageCallbackProxy() override;
  20. // ErrorPageDelegate:
  21. bool OnBackToSafety() override;
  22. std::unique_ptr<ErrorPage> GetErrorPageContent(
  23. Navigation* navigation) override;
  24. private:
  25. raw_ptr<Tab> tab_;
  26. base::android::ScopedJavaGlobalRef<jobject> java_impl_;
  27. };
  28. } // namespace weblayer
  29. #endif // WEBLAYER_BROWSER_ERROR_PAGE_CALLBACK_PROXY_H_