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