1 // Copyright 2017 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 
5 #ifndef CHROME_BROWSER_UI_ANDROID_INFOBARS_FRAMEBUST_BLOCK_INFOBAR_H_
6 #define CHROME_BROWSER_UI_ANDROID_INFOBARS_FRAMEBUST_BLOCK_INFOBAR_H_
7 
8 #include "base/android/jni_android.h"
9 #include "base/android/scoped_java_ref.h"
10 #include "base/macros.h"
11 #include "components/infobars/android/infobar_android.h"
12 
13 namespace content {
14 class WebContents;
15 }
16 
17 class FramebustBlockMessageDelegate;
18 
19 // Communicates to the user about the intervention performed by the browser by
20 // blocking a framebust.
21 // That InfoBar shows a link to the URL that was blocked if the user wants to
22 // bypass the intervention, and a "OK" button to acknowledge and accept it.
23 // See FramebustBlockInfoBar.java for UI specifics.
24 class FramebustBlockInfoBar : public infobars::InfoBarAndroid {
25  public:
26   ~FramebustBlockInfoBar() override;
27 
28   static void Show(content::WebContents* web_contents,
29                    std::unique_ptr<FramebustBlockMessageDelegate> delegate);
30 
31  private:
32   explicit FramebustBlockInfoBar(
33       std::unique_ptr<FramebustBlockMessageDelegate> delegate);
34 
35   // infobars::InfoBarAndroid:
36   base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar(
37       JNIEnv* env) override;
38   void ProcessButton(int action) override;
39   void OnLinkClicked(JNIEnv* env,
40                      const base::android::JavaParamRef<jobject>& obj) override;
41 
42   std::unique_ptr<FramebustBlockMessageDelegate> delegate_;
43 
44   DISALLOW_COPY_AND_ASSIGN(FramebustBlockInfoBar);
45 };
46 
47 #endif  // CHROME_BROWSER_UI_ANDROID_INFOBARS_FRAMEBUST_BLOCK_INFOBAR_H_
48