OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 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_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/android/jni_android.h" |
| 11 #include "base/macros.h" |
| 12 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 13 #include "components/infobars/core/infobar_delegate.h" |
| 14 |
| 15 namespace content { |
| 16 class WebContents; |
| 17 } |
| 18 |
| 19 namespace infobars { |
| 20 class InfoBarManager; |
| 21 } |
| 22 |
| 23 // An infobar that prompts the user to enable the data reduction proxy. |
| 24 class DataReductionPromoInfoBarDelegateAndroid : public ConfirmInfoBarDelegate { |
| 25 public: |
| 26 // Creates the infobar and adds it to the provided |web_contents|. |
| 27 static void Create(content::WebContents* web_contents); |
| 28 |
| 29 DataReductionPromoInfoBarDelegateAndroid(); |
| 30 ~DataReductionPromoInfoBarDelegateAndroid() override; |
| 31 |
| 32 static bool Register(JNIEnv* env); |
| 33 |
| 34 static void Launch(JNIEnv* env, |
| 35 jclass, |
| 36 jobject jweb_contents); |
| 37 |
| 38 base::android::ScopedJavaLocalRef<jobject> CreateRenderInfoBar(JNIEnv* env); |
| 39 |
| 40 private: |
| 41 // Returns a Data Reduction Proxy infobar that owns |delegate|. |
| 42 static std::unique_ptr<infobars::InfoBar> CreateInfoBar( |
| 43 infobars::InfoBarManager* infobar_manager, |
| 44 std::unique_ptr<DataReductionPromoInfoBarDelegateAndroid> delegate); |
| 45 |
| 46 // ConfirmInfoBarDelegate: |
| 47 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| 48 base::string16 GetMessageText() const override; |
| 49 bool Accept() override; |
| 50 |
| 51 base::android::ScopedJavaGlobalRef<jobject> |
| 52 java_data_reduction_promo_delegate_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(DataReductionPromoInfoBarDelegateAndroid); |
| 55 }; |
| 56 |
| 57 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_AN
DROID_H_ |
OLD | NEW |