Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2363)

Unified Diff: chrome/browser/net/spdyproxy/data_reduction_promo_infobar_delegate_android.cc

Issue 2022313002: UI for the Data Saver InfoBar Promo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@infobarPromo
Patch Set: pkasting comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/spdyproxy/data_reduction_promo_infobar_delegate_android.cc
diff --git a/chrome/browser/net/spdyproxy/data_reduction_promo_infobar_delegate_android.cc b/chrome/browser/net/spdyproxy/data_reduction_promo_infobar_delegate_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..81fcbb403f5cbf5e182c5451ce4f1f96c6b3b87f
--- /dev/null
+++ b/chrome/browser/net/spdyproxy/data_reduction_promo_infobar_delegate_android.cc
@@ -0,0 +1,81 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/net/spdyproxy/data_reduction_promo_infobar_delegate_android.h"
+
+#include "base/memory/ptr_util.h"
+#include "chrome/browser/android/android_theme_resources.h"
+#include "chrome/browser/infobars/infobar_service.h"
+#include "components/infobars/core/infobar.h"
+#include "components/infobars/core/infobar_delegate.h"
+#include "content/public/browser/web_contents.h"
+#include "grit/components_strings.h"
+#include "jni/DataReductionPromoInfoBarDelegate_jni.h"
+#include "ui/base/l10n/l10n_util.h"
+
+// static
+void DataReductionPromoInfoBarDelegateAndroid::Create(
+ content::WebContents* web_contents) {
+ InfoBarService* infobar_service =
+ InfoBarService::FromWebContents(web_contents);
+ infobar_service->AddInfoBar(
+ DataReductionPromoInfoBarDelegateAndroid::CreateInfoBar(
+ infobar_service,
+ base::MakeUnique<DataReductionPromoInfoBarDelegateAndroid>()));
+}
+
+DataReductionPromoInfoBarDelegateAndroid::
+ DataReductionPromoInfoBarDelegateAndroid() {}
+
+DataReductionPromoInfoBarDelegateAndroid::
+ ~DataReductionPromoInfoBarDelegateAndroid() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_DataReductionPromoInfoBarDelegate_destroy(env);
+}
+
+// static
+bool DataReductionPromoInfoBarDelegateAndroid::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+// static
+void DataReductionPromoInfoBarDelegateAndroid::Launch(
+ JNIEnv* env, jclass, jobject jweb_contents) {
+ content::WebContents* web_contents =
+ content::WebContents::FromJavaWebContents(jweb_contents);
+ DCHECK(web_contents);
+ Create(web_contents);
+}
+
+base::android::ScopedJavaLocalRef<jobject>
+DataReductionPromoInfoBarDelegateAndroid::CreateRenderInfoBar(JNIEnv* env) {
+ java_data_reduction_promo_delegate_.Reset(
gone 2016/06/29 17:25:08 Since you're not actually doing anything with the
megjablon 2016/06/29 20:11:30 Done.
+ Java_DataReductionPromoInfoBarDelegate_create(env));
+
+ return Java_DataReductionPromoInfoBarDelegate_showPromoInfoBar(
+ env, java_data_reduction_promo_delegate_.obj());
+}
+
+infobars::InfoBarDelegate::InfoBarIdentifier
+DataReductionPromoInfoBarDelegateAndroid::GetIdentifier() const {
+ return DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDROID;
+}
+
+base::string16 DataReductionPromoInfoBarDelegateAndroid::GetMessageText()
+ const {
+ return base::string16();
+}
+
+bool DataReductionPromoInfoBarDelegateAndroid::Accept() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_DataReductionPromoInfoBarDelegate_accept(env);
+ return true;
+}
+
+// JNI for DataReductionPromoInfoBarDelegate.
+void Launch(JNIEnv* env,
+ const JavaParamRef<jclass>& clazz,
+ const JavaParamRef<jobject>& jweb_contents) {
+ DataReductionPromoInfoBarDelegateAndroid::Launch(env, clazz, jweb_contents);
+}

Powered by Google App Engine
This is Rietveld 408576698