Chromium Code Reviews| 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/grouped_permission_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/grouped_permission_infobar.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "chrome/browser/android/resource_mapper.h" | 10 #include "chrome/browser/android/resource_mapper.h" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 | 35 |
| 36 void GroupedPermissionInfoBar::ProcessButton(int action) { | 36 void GroupedPermissionInfoBar::ProcessButton(int action) { |
| 37 // Check if the delegate asked us to display a persistence toggle. If so, | 37 // Check if the delegate asked us to display a persistence toggle. If so, |
| 38 // inform it of the toggle state. | 38 // inform it of the toggle state. |
| 39 GroupedPermissionInfoBarDelegate* delegate = GetDelegate(); | 39 GroupedPermissionInfoBarDelegate* delegate = GetDelegate(); |
| 40 if (delegate->ShouldShowPersistenceToggle()) { | 40 if (delegate->ShouldShowPersistenceToggle()) { |
| 41 delegate->set_persist(Java_GroupedPermissionInfoBar_isPersistSwitchOn( | 41 delegate->set_persist(Java_GroupedPermissionInfoBar_isPersistSwitchOn( |
| 42 base::android::AttachCurrentThread(), GetJavaInfoBar())); | 42 base::android::AttachCurrentThread(), GetJavaInfoBar())); |
| 43 } | 43 } |
| 44 | 44 |
| 45 ConfirmInfoBar::ProcessButton(action); | 45 DCHECK((action == InfoBarAndroid::ACTION_OK) || |
|
dominickn
2016/10/26 05:01:45
Do you actually need this change? ConfirmInfoBar::
lshang
2016/10/26 05:43:23
Done.
| |
| 46 (action == InfoBarAndroid::ACTION_CANCEL)); | |
| 47 if ((action == InfoBarAndroid::ACTION_OK) ? delegate->Accept() | |
| 48 : delegate->Cancel()) | |
| 49 RemoveSelf(); | |
| 46 } | 50 } |
| 47 | 51 |
| 48 base::android::ScopedJavaLocalRef<jobject> | 52 base::android::ScopedJavaLocalRef<jobject> |
| 49 GroupedPermissionInfoBar::CreateRenderInfoBar(JNIEnv* env) { | 53 GroupedPermissionInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
| 50 GroupedPermissionInfoBarDelegate* delegate = GetDelegate(); | 54 GroupedPermissionInfoBarDelegate* delegate = GetDelegate(); |
| 51 | 55 |
| 52 base::android::ScopedJavaLocalRef<jstring> message_text = | 56 base::android::ScopedJavaLocalRef<jstring> message_text = |
| 53 base::android::ConvertUTF16ToJavaString( | 57 base::android::ConvertUTF16ToJavaString( |
| 54 env, delegate->GetMessageText()); | 58 env, delegate->GetMessageText()); |
| 55 base::android::ScopedJavaLocalRef<jstring> ok_button_text = | 59 base::android::ScopedJavaLocalRef<jstring> ok_button_text = |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 83 const base::android::JavaRef<jobject>& java_info_bar) { | 87 const base::android::JavaRef<jobject>& java_info_bar) { |
| 84 InfoBarAndroid::SetJavaInfoBar(java_info_bar); | 88 InfoBarAndroid::SetJavaInfoBar(java_info_bar); |
| 85 JNIEnv* env = base::android::AttachCurrentThread(); | 89 JNIEnv* env = base::android::AttachCurrentThread(); |
| 86 Java_GroupedPermissionInfoBar_setNativePtr(env, java_info_bar, | 90 Java_GroupedPermissionInfoBar_setNativePtr(env, java_info_bar, |
| 87 reinterpret_cast<intptr_t>(this)); | 91 reinterpret_cast<intptr_t>(this)); |
| 88 } | 92 } |
| 89 | 93 |
| 90 GroupedPermissionInfoBarDelegate* GroupedPermissionInfoBar::GetDelegate() { | 94 GroupedPermissionInfoBarDelegate* GroupedPermissionInfoBar::GetDelegate() { |
| 91 return static_cast<GroupedPermissionInfoBarDelegate*>(delegate()); | 95 return static_cast<GroupedPermissionInfoBarDelegate*>(delegate()); |
| 92 } | 96 } |
| OLD | NEW |