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/permissions/permission_dialog_delegate.h" | 5 #include "chrome/browser/permissions/permission_dialog_delegate.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_array.h" | 10 #include "base/android/jni_array.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 DCHECK_EQ(1u, permission_prompt_->PermissionCount()); | 150 DCHECK_EQ(1u, permission_prompt_->PermissionCount()); |
151 | 151 |
152 std::vector<int> content_settings_types{ | 152 std::vector<int> content_settings_types{ |
153 permission_prompt_->GetContentSettingType(0)}; | 153 permission_prompt_->GetContentSettingType(0)}; |
154 | 154 |
155 j_delegate_.Reset(Java_PermissionDialogDelegate_create( | 155 j_delegate_.Reset(Java_PermissionDialogDelegate_create( |
156 env, reinterpret_cast<uintptr_t>(this), tab_->GetJavaObject(), | 156 env, reinterpret_cast<uintptr_t>(this), tab_->GetJavaObject(), |
157 base::android::ToJavaIntArray(env, content_settings_types).obj(), | 157 base::android::ToJavaIntArray(env, content_settings_types).obj(), |
158 ResourceMapper::MapFromChromiumId( | 158 ResourceMapper::MapFromChromiumId( |
159 permission_prompt_->GetIconIdForPermission(0)), | 159 permission_prompt_->GetIconIdForPermission(0)), |
160 // TODO(timloh): This is the wrong string. | 160 ConvertUTF16ToJavaString(env, permission_prompt_->GetMessageText(0)), |
161 ConvertUTF16ToJavaString(env, | |
162 permission_prompt_->GetMessageTextFragment(0)), | |
163 // TODO(timloh): Pass the actual link text for EME. | 161 // TODO(timloh): Pass the actual link text for EME. |
164 ConvertUTF16ToJavaString(env, base::string16()), primaryButtonText, | 162 ConvertUTF16ToJavaString(env, base::string16()), primaryButtonText, |
165 secondaryButtonText, | 163 secondaryButtonText, |
166 // TODO(timloh): Hook up the persistence toggle. | 164 // TODO(timloh): Hook up the persistence toggle. |
167 false)); | 165 false)); |
168 } | 166 } |
169 | 167 |
170 void PermissionDialogDelegate::Accept(JNIEnv* env, | 168 void PermissionDialogDelegate::Accept(JNIEnv* env, |
171 const JavaParamRef<jobject>& obj, | 169 const JavaParamRef<jobject>& obj, |
172 jboolean persist) { | 170 jboolean persist) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 262 } |
265 | 263 |
266 DismissDialog(); | 264 DismissDialog(); |
267 delete this; | 265 delete this; |
268 } | 266 } |
269 | 267 |
270 void PermissionDialogDelegate::WebContentsDestroyed() { | 268 void PermissionDialogDelegate::WebContentsDestroyed() { |
271 DismissDialog(); | 269 DismissDialog(); |
272 delete this; | 270 delete this; |
273 } | 271 } |
OLD | NEW |