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" | |
22 | 21 |
23 using base::android::JavaParamRef; | 22 using base::android::JavaParamRef; |
24 | 23 |
25 namespace { | 24 namespace { |
26 | 25 |
27 // Delegate for a simple ConfirmInfoBar triggered via JNI. | 26 // Delegate for a simple ConfirmInfoBar triggered via JNI. |
28 class SimpleConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { | 27 class SimpleConfirmInfoBarDelegate : public ConfirmInfoBarDelegate { |
29 public: | 28 public: |
30 SimpleConfirmInfoBarDelegate( | 29 SimpleConfirmInfoBarDelegate( |
31 const JavaParamRef<jobject>& j_listener, | 30 const JavaParamRef<jobject>& j_listener, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 TabAndroid::GetNativeTab(env, j_tab)->web_contents()); | 161 TabAndroid::GetNativeTab(env, j_tab)->web_contents()); |
163 service->AddInfoBar(service->CreateConfirmInfoBar( | 162 service->AddInfoBar(service->CreateConfirmInfoBar( |
164 base::MakeUnique<SimpleConfirmInfoBarDelegate>( | 163 base::MakeUnique<SimpleConfirmInfoBarDelegate>( |
165 j_listener, infobar_identifier, icon_bitmap, message_str, primary_str, | 164 j_listener, infobar_identifier, icon_bitmap, message_str, primary_str, |
166 secondary_str, auto_expire))); | 165 secondary_str, auto_expire))); |
167 } | 166 } |
168 | 167 |
169 bool RegisterSimpleConfirmInfoBarBuilder(JNIEnv* env) { | 168 bool RegisterSimpleConfirmInfoBarBuilder(JNIEnv* env) { |
170 return RegisterNativesImpl(env); | 169 return RegisterNativesImpl(env); |
171 } | 170 } |
OLD | NEW |