| 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> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "chrome/browser/android/tab_android.h" | 14 #include "chrome/browser/android/tab_android.h" |
| 15 #include "chrome/browser/infobars/infobar_service.h" | 15 #include "chrome/browser/infobars/infobar_service.h" |
| 16 #include "components/infobars/core/confirm_infobar_delegate.h" | 16 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 17 #include "components/infobars/core/infobar.h" | 17 #include "components/infobars/core/infobar.h" |
| 18 #include "jni/SimpleConfirmInfoBarBuilder_jni.h" | 18 #include "jni/SimpleConfirmInfoBarBuilder_jni.h" |
| 19 #include "ui/gfx/android/java_bitmap.h" | 19 #include "ui/gfx/android/java_bitmap.h" |
| 20 #include "ui/gfx/image/image.h" | 20 #include "ui/gfx/image/image.h" |
| 21 #include "ui/gfx/vector_icons_public.h" | 21 #include "ui/gfx/vector_icons_public.h" |
| 22 | 22 |
| 23 using base::android::JavaParamRef; |
| 24 |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 // Delegate for a simple ConfirmInfoBar triggered via JNI. | 27 // Delegate for a simple ConfirmInfoBar triggered via JNI. |
| 26 class SimpleConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { | 28 class SimpleConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 27 public: | 29 public: |
| 28 SimpleConfirmInfoBarDelegate( | 30 SimpleConfirmInfoBarDelegate( |
| 29 const JavaParamRef<jobject>& j_listener, | 31 const JavaParamRef<jobject>& j_listener, |
| 30 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier, | 32 infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier, |
| 31 const gfx::Image& bitmap, | 33 const gfx::Image& bitmap, |
| 32 const base::string16& message_str, | 34 const base::string16& message_str, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 base::WrapUnique(new SimpleConfirmInfoBarDelegate( | 164 base::WrapUnique(new SimpleConfirmInfoBarDelegate( |
| 163 j_listener, infobar_identifier, icon_bitmap, message_str, primary_str, | 165 j_listener, infobar_identifier, icon_bitmap, message_str, primary_str, |
| 164 secondary_str, auto_expire)))); | 166 secondary_str, auto_expire)))); |
| 165 } | 167 } |
| 166 | 168 |
| 167 bool RegisterSimpleConfirmInfoBarBuilder(JNIEnv* env) { | 169 bool RegisterSimpleConfirmInfoBarBuilder(JNIEnv* env) { |
| 168 return RegisterNativesImpl(env); | 170 return RegisterNativesImpl(env); |
| 169 } | 171 } |
| OLD | NEW |