| 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/confirm_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/confirm_infobar.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/android/resource_mapper.h" | 10 #include "chrome/browser/android/resource_mapper.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 base::android::ConvertUTF16ToJavaString( | 41 base::android::ConvertUTF16ToJavaString( |
| 42 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL)); | 42 env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL)); |
| 43 base::android::ScopedJavaLocalRef<jstring> message_text = | 43 base::android::ScopedJavaLocalRef<jstring> message_text = |
| 44 base::android::ConvertUTF16ToJavaString( | 44 base::android::ConvertUTF16ToJavaString( |
| 45 env, delegate_->GetMessageText()); | 45 env, delegate_->GetMessageText()); |
| 46 base::android::ScopedJavaLocalRef<jstring> link_text = | 46 base::android::ScopedJavaLocalRef<jstring> link_text = |
| 47 base::android::ConvertUTF16ToJavaString( | 47 base::android::ConvertUTF16ToJavaString( |
| 48 env, delegate_->GetLinkText()); | 48 env, delegate_->GetLinkText()); |
| 49 | 49 |
| 50 return Java_ConfirmInfoBarDelegate_showConfirmInfoBar( | 50 return Java_ConfirmInfoBarDelegate_showConfirmInfoBar( |
| 51 env, java_confirm_delegate_.obj(), reinterpret_cast<jint>(this), | 51 env, java_confirm_delegate_.obj(), reinterpret_cast<intptr_t>(this), |
| 52 GetEnumeratedIconId(), message_text.obj(), link_text.obj(), | 52 GetEnumeratedIconId(), message_text.obj(), link_text.obj(), |
| 53 ok_button_text.obj(), cancel_button_text.obj()); | 53 ok_button_text.obj(), cancel_button_text.obj()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ConfirmInfoBar::OnLinkClicked(JNIEnv* env, jobject obj) { | 56 void ConfirmInfoBar::OnLinkClicked(JNIEnv* env, jobject obj) { |
| 57 DCHECK(delegate_); | 57 DCHECK(delegate_); |
| 58 if (!owner()) | 58 if (!owner()) |
| 59 return; // We're closing; don't call anything, it might access the owner. | 59 return; // We're closing; don't call anything, it might access the owner. |
| 60 | 60 |
| 61 if (delegate_->LinkClicked(NEW_FOREGROUND_TAB)) | 61 if (delegate_->LinkClicked(NEW_FOREGROUND_TAB)) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 78 return (delegate_->GetButtons() & button) ? | 78 return (delegate_->GetButtons() & button) ? |
| 79 delegate_->GetButtonLabel(button) : string16(); | 79 delegate_->GetButtonLabel(button) : string16(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 // Native JNI methods --------------------------------------------------------- | 83 // Native JNI methods --------------------------------------------------------- |
| 84 | 84 |
| 85 bool RegisterConfirmInfoBarDelegate(JNIEnv* env) { | 85 bool RegisterConfirmInfoBarDelegate(JNIEnv* env) { |
| 86 return RegisterNativesImpl(env); | 86 return RegisterNativesImpl(env); |
| 87 } | 87 } |
| OLD | NEW |