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

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

Issue 384853002: Add notification of data reduction proxy field trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 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 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 // DataReductionProxyInfoBar:
16
17 // static
18 void DataReductionProxyInfoBar::Launch(
19 JNIEnv* env, jclass, jobject jweb_contents) {
20 content::WebContents* web_contents =
21 content::WebContents::FromJavaWebContents(jweb_contents);
22 DCHECK(web_contents);
23 DataReductionProxyInfoBarDelegate::Create(web_contents);
24 }
25
26 // static
27 bool DataReductionProxyInfoBar::Register(JNIEnv* env) {
28 return RegisterNativesImpl(env);
29 }
30
31 DataReductionProxyInfoBar::DataReductionProxyInfoBar(
32 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate)
33 : ConfirmInfoBar(delegate.PassAs<ConfirmInfoBarDelegate>()),
34 java_data_reduction_proxy_delegate_() {
35 }
36
37 DataReductionProxyInfoBar::~DataReductionProxyInfoBar() {
38 }
39
40 base::android::ScopedJavaLocalRef<jobject>
41 DataReductionProxyInfoBar::CreateRenderInfoBar(JNIEnv* env) {
42 java_data_reduction_proxy_delegate_.Reset(
43 Java_DataReductionProxyInfoBarDelegate_create(env));
44
45 return Java_DataReductionProxyInfoBarDelegate_showDataReductionProxyInfoBar(
46 env,
47 java_data_reduction_proxy_delegate_.obj(),
48 reinterpret_cast<intptr_t>(this),
49 GetEnumeratedIconId());
50 }
51
52 DataReductionProxyInfoBarDelegate* DataReductionProxyInfoBar::GetDelegate() {
53 return static_cast<DataReductionProxyInfoBarDelegate*>(delegate());
54 }
55
56
57 // DataReductionProxyInfoBarDelegate:
58
59 // static
60 scoped_ptr<infobars::InfoBar> DataReductionProxyInfoBarDelegate::CreateInfoBar(
61 scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) {
62 return scoped_ptr<infobars::InfoBar>(
63 new DataReductionProxyInfoBar(delegate.Pass()));
64 }
65
66
67 // JNI for DataReductionProxyInfoBarDelegate.
68 void Launch(JNIEnv* env, jclass clazz, jobject jweb_contents) {
69 DataReductionProxyInfoBar::Launch(env, clazz, jweb_contents);
70 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698