OLD | NEW |
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/infobar_android.h" | 5 #include "chrome/browser/ui/android/infobars/infobar_android.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
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/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "chrome/browser/android/resource_mapper.h" | 12 #include "chrome/browser/android/resource_mapper.h" |
13 #include "chrome/browser/infobars/infobar_service.h" | 13 #include "chrome/browser/infobars/infobar_service.h" |
14 #include "components/infobars/core/infobar.h" | 14 #include "components/infobars/core/infobar.h" |
15 #include "components/infobars/core/infobar_delegate.h" | 15 #include "components/infobars/core/infobar_delegate.h" |
16 #include "jni/InfoBar_jni.h" | 16 #include "jni/InfoBar_jni.h" |
17 | 17 |
18 | 18 |
19 // InfoBarAndroid ------------------------------------------------------------- | 19 // InfoBarAndroid ------------------------------------------------------------- |
20 | 20 |
21 InfoBarAndroid::InfoBarAndroid(scoped_ptr<infobars::InfoBarDelegate> delegate) | 21 InfoBarAndroid::InfoBarAndroid( |
| 22 std::unique_ptr<infobars::InfoBarDelegate> delegate) |
22 : infobars::InfoBar(std::move(delegate)) {} | 23 : infobars::InfoBar(std::move(delegate)) {} |
23 | 24 |
24 InfoBarAndroid::~InfoBarAndroid() { | 25 InfoBarAndroid::~InfoBarAndroid() { |
25 if (!java_info_bar_.is_null()) { | 26 if (!java_info_bar_.is_null()) { |
26 JNIEnv* env = base::android::AttachCurrentThread(); | 27 JNIEnv* env = base::android::AttachCurrentThread(); |
27 Java_InfoBar_onNativeDestroyed(env, java_info_bar_.obj()); | 28 Java_InfoBar_onNativeDestroyed(env, java_info_bar_.obj()); |
28 } | 29 } |
29 } | 30 } |
30 | 31 |
31 void InfoBarAndroid::ReassignJavaInfoBar(InfoBarAndroid* replacement) { | 32 void InfoBarAndroid::ReassignJavaInfoBar(InfoBarAndroid* replacement) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 int InfoBarAndroid::GetEnumeratedIconId() { | 78 int InfoBarAndroid::GetEnumeratedIconId() { |
78 return ResourceMapper::MapFromChromiumId(delegate()->GetIconId()); | 79 return ResourceMapper::MapFromChromiumId(delegate()->GetIconId()); |
79 } | 80 } |
80 | 81 |
81 | 82 |
82 // Native JNI methods --------------------------------------------------------- | 83 // Native JNI methods --------------------------------------------------------- |
83 | 84 |
84 bool RegisterNativeInfoBar(JNIEnv* env) { | 85 bool RegisterNativeInfoBar(JNIEnv* env) { |
85 return RegisterNativesImpl(env); | 86 return RegisterNativesImpl(env); |
86 } | 87 } |
OLD | NEW |