Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.h" | |
| 6 | |
| 7 #include "base/android/jni_android.h" | |
| 8 #include "base/android/jni_string.h" | |
| 9 #include "base/logging.h" | |
| 10 #include "chrome/browser/android/resource_mapper.h" | |
| 11 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h" | |
| 12 #include "content/public/browser/web_contents.h" | |
| 13 #include "jni/DataReductionProxyInfoBarDelegate_jni.h" | |
| 14 | |
| 15 void Launch(JNIEnv* env, jclass clazz, jobject jweb_contents) { | |
|
aruslan
2014/07/15 23:14:28
nit: add some comment like // JNI for DataReductio
bengr
2014/07/16 00:43:25
Done.
| |
| 16 DataReductionProxyInfoBar::Launch(env, clazz, jweb_contents); | |
| 17 } | |
| 18 | |
| 19 // static | |
| 20 void DataReductionProxyInfoBar::Launch( | |
| 21 JNIEnv* env, jclass, jobject jweb_contents) { | |
| 22 content::WebContents* web_contents = | |
| 23 content::WebContents::FromJavaWebContents(jweb_contents); | |
| 24 DCHECK(web_contents); | |
| 25 DataReductionProxyInfoBarDelegate::Create(web_contents); | |
| 26 } | |
| 27 | |
| 28 // static | |
| 29 scoped_ptr<infobars::InfoBar> DataReductionProxyInfoBarDelegate::CreateInfoBar( | |
|
aruslan
2014/07/15 23:14:28
nit: This file combines implementations from diffe
aruslan
2014/07/15 23:14:28
nit: It would be great if you could order the meth
bengr
2014/07/16 00:43:25
Done.
bengr
2014/07/16 00:43:25
Done.
| |
| 30 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) { | |
| 31 return scoped_ptr<infobars::InfoBar>( | |
| 32 new DataReductionProxyInfoBar(delegate.Pass())); | |
| 33 } | |
| 34 | |
| 35 DataReductionProxyInfoBar::DataReductionProxyInfoBar( | |
| 36 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) | |
| 37 : ConfirmInfoBar(delegate.PassAs<ConfirmInfoBarDelegate>()), | |
| 38 java_data_reduction_proxy_delegate_() { | |
| 39 } | |
| 40 | |
| 41 DataReductionProxyInfoBar::~DataReductionProxyInfoBar() { | |
| 42 } | |
| 43 | |
| 44 base::android::ScopedJavaLocalRef<jobject> | |
| 45 DataReductionProxyInfoBar::CreateRenderInfoBar(JNIEnv* env) { | |
| 46 java_data_reduction_proxy_delegate_.Reset( | |
| 47 Java_DataReductionProxyInfoBarDelegate_create(env)); | |
| 48 | |
| 49 return Java_DataReductionProxyInfoBarDelegate_showDataReductionProxyInfoBar( | |
| 50 env, | |
| 51 java_data_reduction_proxy_delegate_.obj(), | |
| 52 reinterpret_cast<intptr_t>(this), | |
| 53 GetEnumeratedIconId()); | |
| 54 } | |
| 55 | |
| 56 DataReductionProxyInfoBarDelegate* DataReductionProxyInfoBar::GetDelegate() { | |
| 57 return static_cast<DataReductionProxyInfoBarDelegate*>(delegate()); | |
| 58 } | |
| 59 | |
| 60 bool DataReductionProxyInfoBar::Register(JNIEnv* env) { | |
| 61 return RegisterNativesImpl(env); | |
| 62 } | |
| OLD | NEW |