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

Side by Side Diff: chrome/browser/ui/android/infobars/confirm_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/confirm_infobar.h" 5 #include "chrome/browser/ui/android/infobars/confirm_infobar.h"
6 6
7 #include <utility>
7 #include <vector> 8 #include <vector>
8 9
9 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 11 #include "base/android/jni_array.h"
11 #include "base/android/jni_string.h" 12 #include "base/android/jni_string.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "chrome/browser/android/resource_mapper.h" 15 #include "chrome/browser/android/resource_mapper.h"
15 #include "chrome/browser/infobars/infobar_service.h" 16 #include "chrome/browser/infobars/infobar_service.h"
16 #include "chrome/browser/permissions/permission_infobar_delegate.h" 17 #include "chrome/browser/permissions/permission_infobar_delegate.h"
17 #include "components/content_settings/core/common/content_settings_types.h" 18 #include "components/content_settings/core/common/content_settings_types.h"
18 #include "components/infobars/core/confirm_infobar_delegate.h" 19 #include "components/infobars/core/confirm_infobar_delegate.h"
19 #include "content/public/browser/android/content_view_core.h" 20 #include "content/public/browser/android/content_view_core.h"
20 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
21 #include "jni/ConfirmInfoBarDelegate_jni.h" 22 #include "jni/ConfirmInfoBarDelegate_jni.h"
22 #include "ui/android/window_android.h" 23 #include "ui/android/window_android.h"
23 #include "ui/gfx/android/java_bitmap.h" 24 #include "ui/gfx/android/java_bitmap.h"
24 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
25 26
26 #if defined(OS_ANDROID) 27 #if defined(OS_ANDROID)
27 #include "chrome/browser/media/media_stream_infobar_delegate_android.h" 28 #include "chrome/browser/media/media_stream_infobar_delegate_android.h"
28 #endif 29 #endif
29 30
30 // InfoBarService ------------------------------------------------------------- 31 // InfoBarService -------------------------------------------------------------
31 32
32 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( 33 scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar(
33 scoped_ptr<ConfirmInfoBarDelegate> delegate) { 34 scoped_ptr<ConfirmInfoBarDelegate> delegate) {
34 return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass())); 35 return make_scoped_ptr(new ConfirmInfoBar(std::move(delegate)));
35 } 36 }
36 37
37 38
38 // ConfirmInfoBar ------------------------------------------------------------- 39 // ConfirmInfoBar -------------------------------------------------------------
39 40
40 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate) 41 ConfirmInfoBar::ConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate> delegate)
41 : InfoBarAndroid(delegate.Pass()), java_confirm_delegate_() { 42 : InfoBarAndroid(std::move(delegate)), java_confirm_delegate_() {}
42 }
43 43
44 ConfirmInfoBar::~ConfirmInfoBar() { 44 ConfirmInfoBar::~ConfirmInfoBar() {
45 } 45 }
46 46
47 base::android::ScopedJavaLocalRef<jobject> ConfirmInfoBar::CreateRenderInfoBar( 47 base::android::ScopedJavaLocalRef<jobject> ConfirmInfoBar::CreateRenderInfoBar(
48 JNIEnv* env) { 48 JNIEnv* env) {
49 java_confirm_delegate_.Reset(Java_ConfirmInfoBarDelegate_create(env)); 49 java_confirm_delegate_.Reset(Java_ConfirmInfoBarDelegate_create(env));
50 base::android::ScopedJavaLocalRef<jstring> ok_button_text = 50 base::android::ScopedJavaLocalRef<jstring> ok_button_text =
51 base::android::ConvertUTF16ToJavaString( 51 base::android::ConvertUTF16ToJavaString(
52 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK)); 52 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return (delegate->GetButtons() & button) ? 134 return (delegate->GetButtons() & button) ?
135 delegate->GetButtonLabel(button) : base::string16(); 135 delegate->GetButtonLabel(button) : base::string16();
136 } 136 }
137 137
138 138
139 // Native JNI methods --------------------------------------------------------- 139 // Native JNI methods ---------------------------------------------------------
140 140
141 bool RegisterConfirmInfoBarDelegate(JNIEnv* env) { 141 bool RegisterConfirmInfoBarDelegate(JNIEnv* env) {
142 return RegisterNativesImpl(env); 142 return RegisterNativesImpl(env);
143 } 143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698