page_impl.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2021 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_PAGE_IMPL_H_
  5. #define WEBLAYER_BROWSER_PAGE_IMPL_H_
  6. #include "build/build_config.h"
  7. #include "content/public/browser/page_user_data.h"
  8. #include "weblayer/public/page.h"
  9. #if BUILDFLAG(IS_ANDROID)
  10. #include "base/android/scoped_java_ref.h"
  11. #endif
  12. namespace weblayer {
  13. class PageImpl : public Page, public content::PageUserData<PageImpl> {
  14. public:
  15. PageImpl(const PageImpl&) = delete;
  16. PageImpl& operator=(const PageImpl&) = delete;
  17. ~PageImpl() override;
  18. #if BUILDFLAG(IS_ANDROID)
  19. void SetJavaPage(JNIEnv* env,
  20. const base::android::JavaParamRef<jobject>& java_page);
  21. base::android::ScopedJavaGlobalRef<jobject> java_page() { return java_page_; }
  22. #endif
  23. private:
  24. explicit PageImpl(content::Page& page);
  25. friend class content::PageUserData<PageImpl>;
  26. PAGE_USER_DATA_KEY_DECL();
  27. #if BUILDFLAG(IS_ANDROID)
  28. base::android::ScopedJavaGlobalRef<jobject> java_page_;
  29. #endif
  30. };
  31. } // namespace weblayer
  32. #endif // WEBLAYER_BROWSER_PAGE_IMPL_H_