OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDRO
ID_H_ | 5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDRO
ID_H_ |
6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDRO
ID_H_ | 6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDRO
ID_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 11 #include "base/android/scoped_java_ref.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "components/infobars/core/confirm_infobar_delegate.h" | 14 #include "components/infobars/core/confirm_infobar_delegate.h" |
14 #include "components/infobars/core/infobar_delegate.h" | 15 #include "components/infobars/core/infobar_delegate.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class WebContents; | 18 class WebContents; |
18 } | 19 } |
19 | 20 |
20 namespace infobars { | 21 namespace infobars { |
21 class InfoBarManager; | 22 class InfoBarManager; |
22 } | 23 } |
23 | 24 |
24 // An infobar that prompts the user to enable the data reduction proxy. | 25 // An infobar that prompts the user to enable the data reduction proxy. |
25 class DataReductionPromoInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { | 26 class DataReductionPromoInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
26 public: | 27 public: |
27 // Creates the infobar and adds it to the provided |web_contents|. | 28 // Creates the infobar and adds it to the provided |web_contents|. |
28 static void Create(content::WebContents* web_contents); | 29 static void Create(content::WebContents* web_contents); |
29 | 30 |
30 DataReductionPromoInfoBarDelegateAndroid(); | 31 DataReductionPromoInfoBarDelegateAndroid(); |
31 ~DataReductionPromoInfoBarDelegateAndroid() override; | 32 ~DataReductionPromoInfoBarDelegateAndroid() override; |
32 | 33 |
33 static bool Register(JNIEnv* env); | 34 static bool Register(JNIEnv* env); |
34 | 35 |
35 static void Launch(JNIEnv* env, | 36 static void Launch(JNIEnv* env, |
36 jclass, | 37 const base::android::JavaRef<jobject>& jweb_contents); |
37 jobject jweb_contents); | |
38 | 38 |
39 base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar(JNIEnv* env); | 39 base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar(JNIEnv* env); |
40 | 40 |
41 private: | 41 private: |
42 // Returns a Data Reduction Proxy infobar that owns |delegate|. | 42 // Returns a Data Reduction Proxy infobar that owns |delegate|. |
43 static std::unique_ptr<infobars::InfoBar> CreateInfoBar( | 43 static std::unique_ptr<infobars::InfoBar> CreateInfoBar( |
44 infobars::InfoBarManager* infobar_manager, | 44 infobars::InfoBarManager* infobar_manager, |
45 std::unique_ptr<DataReductionPromoInfoBarDelegateAndroid> delegate); | 45 std::unique_ptr<DataReductionPromoInfoBarDelegateAndroid> delegate); |
46 | 46 |
47 // ConfirmInfoBarDelegate: | 47 // ConfirmInfoBarDelegate: |
48 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 48 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
49 base::string16 GetMessageText() const override; | 49 base::string16 GetMessageText() const override; |
50 bool Accept() override; | 50 bool Accept() override; |
51 | 51 |
52 DISALLOW_COPY_AND_ASSIGN(DataReductionPromoInfoBarDelegateAndroid); | 52 DISALLOW_COPY_AND_ASSIGN(DataReductionPromoInfoBarDelegateAndroid); |
53 }; | 53 }; |
54 | 54 |
55 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_AN
DROID_H_ | 55 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_AN
DROID_H_ |
OLD | NEW |