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

Side by Side Diff: chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.cc

Issue 1392023004: Rename android only infobars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try again Created 5 years, 2 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.h" 5 #include "chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/android/resource_mapper.h" 10 #include "chrome/browser/android/resource_mapper.h"
11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h" 11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate_and roid.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "jni/DataReductionProxyInfoBarDelegate_jni.h" 13 #include "jni/DataReductionProxyInfoBarDelegate_jni.h"
14 14
15 // DataReductionProxyInfoBar: 15 // DataReductionProxyInfoBar:
16 16
17 // static 17 // static
18 void DataReductionProxyInfoBar::Launch( 18 void DataReductionProxyInfoBar::Launch(
19 JNIEnv* env, jclass, jobject jweb_contents, jstring jlink_url) { 19 JNIEnv* env, jclass, jobject jweb_contents, jstring jlink_url) {
20 content::WebContents* web_contents = 20 content::WebContents* web_contents =
21 content::WebContents::FromJavaWebContents(jweb_contents); 21 content::WebContents::FromJavaWebContents(jweb_contents);
22 DCHECK(web_contents); 22 DCHECK(web_contents);
23 DataReductionProxyInfoBarDelegate::Create( 23 DataReductionProxyInfoBarDelegateAndroid::Create(
24 web_contents, base::android::ConvertJavaStringToUTF8(env, jlink_url)); 24 web_contents, base::android::ConvertJavaStringToUTF8(env, jlink_url));
25 } 25 }
26 26
27 // static 27 // static
28 bool DataReductionProxyInfoBar::Register(JNIEnv* env) { 28 bool DataReductionProxyInfoBar::Register(JNIEnv* env) {
29 return RegisterNativesImpl(env); 29 return RegisterNativesImpl(env);
30 } 30 }
31 31
32 DataReductionProxyInfoBar::DataReductionProxyInfoBar( 32 DataReductionProxyInfoBar::DataReductionProxyInfoBar(
33 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) 33 scoped_ptr<DataReductionProxyInfoBarDelegateAndroid> delegate)
34 : ConfirmInfoBar(delegate.Pass()), java_data_reduction_proxy_delegate_() { 34 : ConfirmInfoBar(delegate.Pass()), java_data_reduction_proxy_delegate_() {}
35 }
36 35
37 DataReductionProxyInfoBar::~DataReductionProxyInfoBar() { 36 DataReductionProxyInfoBar::~DataReductionProxyInfoBar() {
38 } 37 }
39 38
40 base::android::ScopedJavaLocalRef<jobject> 39 base::android::ScopedJavaLocalRef<jobject>
41 DataReductionProxyInfoBar::CreateRenderInfoBar(JNIEnv* env) { 40 DataReductionProxyInfoBar::CreateRenderInfoBar(JNIEnv* env) {
42 java_data_reduction_proxy_delegate_.Reset( 41 java_data_reduction_proxy_delegate_.Reset(
43 Java_DataReductionProxyInfoBarDelegate_create(env)); 42 Java_DataReductionProxyInfoBarDelegate_create(env));
44 43
45 return Java_DataReductionProxyInfoBarDelegate_showDataReductionProxyInfoBar( 44 return Java_DataReductionProxyInfoBarDelegate_showDataReductionProxyInfoBar(
46 env, java_data_reduction_proxy_delegate_.obj(), GetEnumeratedIconId()); 45 env, java_data_reduction_proxy_delegate_.obj(), GetEnumeratedIconId());
47 } 46 }
48 47
49 DataReductionProxyInfoBarDelegate* DataReductionProxyInfoBar::GetDelegate() { 48 DataReductionProxyInfoBarDelegateAndroid*
50 return static_cast<DataReductionProxyInfoBarDelegate*>(delegate()); 49 DataReductionProxyInfoBar::GetDelegate() {
50 return static_cast<DataReductionProxyInfoBarDelegateAndroid*>(delegate());
51 } 51 }
52 52
53
54 // DataReductionProxyInfoBarDelegate: 53 // DataReductionProxyInfoBarDelegate:
55 54
56 // static 55 // static
57 scoped_ptr<infobars::InfoBar> DataReductionProxyInfoBarDelegate::CreateInfoBar( 56 scoped_ptr<infobars::InfoBar>
57 DataReductionProxyInfoBarDelegateAndroid::CreateInfoBar(
58 infobars::InfoBarManager* infobar_manager, 58 infobars::InfoBarManager* infobar_manager,
59 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) { 59 scoped_ptr<DataReductionProxyInfoBarDelegateAndroid> delegate) {
60 return scoped_ptr<infobars::InfoBar>( 60 return scoped_ptr<infobars::InfoBar>(
61 new DataReductionProxyInfoBar(delegate.Pass())); 61 new DataReductionProxyInfoBar(delegate.Pass()));
62 } 62 }
63 63
64
65 // JNI for DataReductionProxyInfoBarDelegate. 64 // JNI for DataReductionProxyInfoBarDelegate.
66 void Launch(JNIEnv* env, 65 void Launch(JNIEnv* env,
67 const JavaParamRef<jclass>& clazz, 66 const JavaParamRef<jclass>& clazz,
68 const JavaParamRef<jobject>& jweb_contents, 67 const JavaParamRef<jobject>& jweb_contents,
69 const JavaParamRef<jstring>& jlink_url) { 68 const JavaParamRef<jstring>& jlink_url) {
70 DataReductionProxyInfoBar::Launch(env, clazz, jweb_contents, jlink_url); 69 DataReductionProxyInfoBar::Launch(env, clazz, jweb_contents, jlink_url);
71 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698