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

Side by Side 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, 5 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 unified diff | Download patch
OLDNEW
(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 #include "chrome/browser/net/spdyproxy/data_reduction_promo_infobar_delegate_and roid.h"
6
7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/android/android_theme_resources.h"
9 #include "chrome/browser/infobars/infobar_service.h"
10 #include "components/infobars/core/infobar.h"
11 #include "components/infobars/core/infobar_delegate.h"
12 #include "content/public/browser/web_contents.h"
13 #include "grit/components_strings.h"
14 #include "jni/DataReductionPromoInfoBarDelegate_jni.h"
15 #include "ui/base/l10n/l10n_util.h"
16
17 // static
18 void DataReductionPromoInfoBarDelegateAndroid::Create(
19 content::WebContents* web_contents) {
20 InfoBarService* infobar_service =
21 InfoBarService::FromWebContents(web_contents);
22 infobar_service->AddInfoBar(
23 DataReductionPromoInfoBarDelegateAndroid::CreateInfoBar(
24 infobar_service,
25 base::MakeUnique<DataReductionPromoInfoBarDelegateAndroid>()));
26 }
27
28 DataReductionPromoInfoBarDelegateAndroid::
29 DataReductionPromoInfoBarDelegateAndroid() {}
30
31 DataReductionPromoInfoBarDelegateAndroid::
32 ~DataReductionPromoInfoBarDelegateAndroid() {
33 JNIEnv* env = base::android::AttachCurrentThread();
34 Java_DataReductionPromoInfoBarDelegate_destroy(env);
35 }
36
37 // static
38 bool DataReductionPromoInfoBarDelegateAndroid::Register(JNIEnv* env) {
39 return RegisterNativesImpl(env);
40 }
41
42 // static
43 void DataReductionPromoInfoBarDelegateAndroid::Launch(
44 JNIEnv* env, jclass, jobject jweb_contents) {
45 content::WebContents* web_contents =
46 content::WebContents::FromJavaWebContents(jweb_contents);
47 DCHECK(web_contents);
48 Create(web_contents);
49 }
50
51 base::android::ScopedJavaLocalRef<jobject>
52 DataReductionPromoInfoBarDelegateAndroid::CreateRenderInfoBar(JNIEnv* env) {
53 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.
54 Java_DataReductionPromoInfoBarDelegate_create(env));
55
56 return Java_DataReductionPromoInfoBarDelegate_showPromoInfoBar(
57 env, java_data_reduction_promo_delegate_.obj());
58 }
59
60 infobars::InfoBarDelegate::InfoBarIdentifier
61 DataReductionPromoInfoBarDelegateAndroid::GetIdentifier() const {
62 return DATA_REDUCTION_PROMO_INFOBAR_DELEGATE_ANDROID;
63 }
64
65 base::string16 DataReductionPromoInfoBarDelegateAndroid::GetMessageText()
66 const {
67 return base::string16();
68 }
69
70 bool DataReductionPromoInfoBarDelegateAndroid::Accept() {
71 JNIEnv* env = base::android::AttachCurrentThread();
72 Java_DataReductionPromoInfoBarDelegate_accept(env);
73 return true;
74 }
75
76 // JNI for DataReductionPromoInfoBarDelegate.
77 void Launch(JNIEnv* env,
78 const JavaParamRef<jclass>& clazz,
79 const JavaParamRef<jobject>& jweb_contents) {
80 DataReductionPromoInfoBarDelegateAndroid::Launch(env, clazz, jweb_contents);
81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698