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

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

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

Powered by Google App Engine
This is Rietveld 408576698