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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 base::android::ConvertUTF16ToJavaString(env, delegate->GetMessageText()); | 49 base::android::ConvertUTF16ToJavaString(env, delegate->GetMessageText()); |
50 ScopedJavaLocalRef<jstring> link_text = | 50 ScopedJavaLocalRef<jstring> link_text = |
51 base::android::ConvertUTF16ToJavaString(env, delegate->GetLinkText()); | 51 base::android::ConvertUTF16ToJavaString(env, delegate->GetLinkText()); |
52 | 52 |
53 ScopedJavaLocalRef<jobject> java_bitmap; | 53 ScopedJavaLocalRef<jobject> java_bitmap; |
54 if (delegate->GetIconId() == infobars::InfoBarDelegate::kNoIconID && | 54 if (delegate->GetIconId() == infobars::InfoBarDelegate::kNoIconID && |
55 !delegate->GetIcon().IsEmpty()) { | 55 !delegate->GetIcon().IsEmpty()) { |
56 java_bitmap = gfx::ConvertToJavaBitmap(delegate->GetIcon().ToSkBitmap()); | 56 java_bitmap = gfx::ConvertToJavaBitmap(delegate->GetIcon().ToSkBitmap()); |
57 } | 57 } |
58 | 58 |
59 return Java_ConfirmInfoBar_create( | 59 return Java_ConfirmInfoBar_create(env, GetEnumeratedIconId(), java_bitmap, |
60 env, GetEnumeratedIconId(), java_bitmap.obj(), message_text.obj(), | 60 message_text, link_text, ok_button_text, |
61 link_text.obj(), ok_button_text.obj(), cancel_button_text.obj()); | 61 cancel_button_text); |
62 } | 62 } |
63 | 63 |
64 ScopedJavaLocalRef<jobject> ConfirmInfoBar::GetWindowAndroid() { | 64 ScopedJavaLocalRef<jobject> ConfirmInfoBar::GetWindowAndroid() { |
65 content::WebContents* web_contents = | 65 content::WebContents* web_contents = |
66 InfoBarService::WebContentsFromInfoBar(this); | 66 InfoBarService::WebContentsFromInfoBar(this); |
67 DCHECK(web_contents); | 67 DCHECK(web_contents); |
68 content::ContentViewCore* cvc = | 68 content::ContentViewCore* cvc = |
69 content::ContentViewCore::FromWebContents(web_contents); | 69 content::ContentViewCore::FromWebContents(web_contents); |
70 DCHECK(cvc); | 70 DCHECK(cvc); |
71 return cvc->GetWindowAndroid()->GetJavaObject(); | 71 return cvc->GetWindowAndroid()->GetJavaObject(); |
(...skipping 23 matching lines...) Expand all Loading... |
95 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { | 95 ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() { |
96 return delegate()->AsConfirmInfoBarDelegate(); | 96 return delegate()->AsConfirmInfoBarDelegate(); |
97 } | 97 } |
98 | 98 |
99 base::string16 ConfirmInfoBar::GetTextFor( | 99 base::string16 ConfirmInfoBar::GetTextFor( |
100 ConfirmInfoBarDelegate::InfoBarButton button) { | 100 ConfirmInfoBarDelegate::InfoBarButton button) { |
101 ConfirmInfoBarDelegate* delegate = GetDelegate(); | 101 ConfirmInfoBarDelegate* delegate = GetDelegate(); |
102 return (delegate->GetButtons() & button) ? | 102 return (delegate->GetButtons() & button) ? |
103 delegate->GetButtonLabel(button) : base::string16(); | 103 delegate->GetButtonLabel(button) : base::string16(); |
104 } | 104 } |
OLD | NEW |