| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/simple_confirm_infobar_builder.h" | 5 #include "chrome/browser/ui/android/infobars/simple_confirm_infobar_builder.h" |
| 6 | 6 |
| 7 #include <memory> |
| 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/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/ptr_util.h" |
| 12 #include "chrome/browser/android/tab_android.h" | 14 #include "chrome/browser/android/tab_android.h" |
| 13 #include "chrome/browser/infobars/infobar_service.h" | 15 #include "chrome/browser/infobars/infobar_service.h" |
| 14 #include "components/infobars/core/confirm_infobar_delegate.h" | 16 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 15 #include "components/infobars/core/infobar.h" | 17 #include "components/infobars/core/infobar.h" |
| 16 #include "jni/SimpleConfirmInfoBarBuilder_jni.h" | 18 #include "jni/SimpleConfirmInfoBarBuilder_jni.h" |
| 17 #include "ui/gfx/android/java_bitmap.h" | 19 #include "ui/gfx/android/java_bitmap.h" |
| 18 #include "ui/gfx/image/image.h" | 20 #include "ui/gfx/image/image.h" |
| 19 #include "ui/gfx/vector_icons_public.h" | 21 #include "ui/gfx/vector_icons_public.h" |
| 20 | 22 |
| 21 namespace { | 23 namespace { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 base::string16 primary_str = j_primary.is_null() | 154 base::string16 primary_str = j_primary.is_null() |
| 153 ? base::string16() | 155 ? base::string16() |
| 154 : base::android::ConvertJavaStringToUTF16(env, j_primary); | 156 : base::android::ConvertJavaStringToUTF16(env, j_primary); |
| 155 base::string16 secondary_str = j_secondary.is_null() | 157 base::string16 secondary_str = j_secondary.is_null() |
| 156 ? base::string16() | 158 ? base::string16() |
| 157 : base::android::ConvertJavaStringToUTF16(env, j_secondary); | 159 : base::android::ConvertJavaStringToUTF16(env, j_secondary); |
| 158 | 160 |
| 159 InfoBarService* service = InfoBarService::FromWebContents( | 161 InfoBarService* service = InfoBarService::FromWebContents( |
| 160 TabAndroid::GetNativeTab(env, j_tab)->web_contents()); | 162 TabAndroid::GetNativeTab(env, j_tab)->web_contents()); |
| 161 service->AddInfoBar(service->CreateConfirmInfoBar( | 163 service->AddInfoBar(service->CreateConfirmInfoBar( |
| 162 make_scoped_ptr(new SimpleConfirmInfoBarDelegate( | 164 base::WrapUnique(new SimpleConfirmInfoBarDelegate( |
| 163 j_listener, | 165 j_listener, infobar_identifier, icon_bitmap, message_str, primary_str, |
| 164 infobar_identifier, | 166 secondary_str, auto_expire)))); |
| 165 icon_bitmap, | |
| 166 message_str, | |
| 167 primary_str, | |
| 168 secondary_str, | |
| 169 auto_expire)))); | |
| 170 } | 167 } |
| 171 | 168 |
| 172 bool RegisterSimpleConfirmInfoBarBuilder(JNIEnv* env) { | 169 bool RegisterSimpleConfirmInfoBarBuilder(JNIEnv* env) { |
| 173 return RegisterNativesImpl(env); | 170 return RegisterNativesImpl(env); |
| 174 } | 171 } |
| OLD | NEW |