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