test_infobar.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2020 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_TEST_TEST_INFOBAR_H_
  5. #define WEBLAYER_BROWSER_TEST_TEST_INFOBAR_H_
  6. #include "base/android/jni_android.h"
  7. #include "base/android/scoped_java_ref.h"
  8. #include "components/infobars/android/infobar_android.h"
  9. #include "components/infobars/core/infobar_delegate.h"
  10. #include "content/public/browser/web_contents.h"
  11. namespace weblayer {
  12. class TestInfoBarDelegate;
  13. // A test infobar.
  14. class TestInfoBar : public infobars::InfoBarAndroid {
  15. public:
  16. explicit TestInfoBar(std::unique_ptr<TestInfoBarDelegate> delegate);
  17. ~TestInfoBar() override;
  18. TestInfoBar(const TestInfoBar&) = delete;
  19. TestInfoBar& operator=(const TestInfoBar&) = delete;
  20. static void Show(content::WebContents* web_contents);
  21. protected:
  22. infobars::InfoBarDelegate* GetDelegate();
  23. // infobars::InfoBarAndroid overrides.
  24. void ProcessButton(int action) override;
  25. base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar(
  26. JNIEnv* env,
  27. const ResourceIdMapper& resource_id_mapper) override;
  28. };
  29. } // namespace weblayer
  30. #endif // WEBLAYER_BROWSER_TEST_TEST_INFOBAR_H_