Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: chrome/browser/permissions/permission_dialog_delegate.cc

Issue 2493013002: Replace the use of WindowAndroid with Tab in permissions code. (Closed)
Patch Set: Comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // static 87 // static
88 bool PermissionDialogDelegate::RegisterPermissionDialogDelegate(JNIEnv* env) { 88 bool PermissionDialogDelegate::RegisterPermissionDialogDelegate(JNIEnv* env) {
89 return RegisterNativesImpl(env); 89 return RegisterNativesImpl(env);
90 } 90 }
91 91
92 ScopedJavaLocalRef<jobject> PermissionDialogDelegate::CreateJavaDelegate( 92 ScopedJavaLocalRef<jobject> PermissionDialogDelegate::CreateJavaDelegate(
93 JNIEnv* env) { 93 JNIEnv* env) {
94 TabAndroid* tab = TabAndroid::FromWebContents(web_contents()); 94 TabAndroid* tab = TabAndroid::FromWebContents(web_contents());
95 DCHECK(tab); 95 DCHECK(tab);
96 96
97 std::vector<int> content_settings{infobar_delegate_->content_settings()}; 97 std::vector<int> content_settings_types{
98 infobar_delegate_->content_settings_types()};
98 99
99 return Java_PermissionDialogDelegate_create( 100 return Java_PermissionDialogDelegate_create(
100 env, reinterpret_cast<uintptr_t>(this), 101 env, reinterpret_cast<uintptr_t>(this),
101 tab->GetJavaObject(), 102 tab->GetJavaObject(),
102 base::android::ToJavaIntArray(env, content_settings).obj(), 103 base::android::ToJavaIntArray(env, content_settings_types).obj(),
103 ResourceMapper::MapFromChromiumId(infobar_delegate_->GetIconId()), 104 ResourceMapper::MapFromChromiumId(infobar_delegate_->GetIconId()),
104 ConvertUTF16ToJavaString(env, infobar_delegate_->GetMessageText()), 105 ConvertUTF16ToJavaString(env, infobar_delegate_->GetMessageText()),
105 ConvertUTF16ToJavaString(env, infobar_delegate_->GetLinkText()), 106 ConvertUTF16ToJavaString(env, infobar_delegate_->GetLinkText()),
106 ConvertUTF16ToJavaString(env, infobar_delegate_->GetButtonLabel( 107 ConvertUTF16ToJavaString(env, infobar_delegate_->GetButtonLabel(
107 PermissionInfoBarDelegate::BUTTON_OK)), 108 PermissionInfoBarDelegate::BUTTON_OK)),
108 ConvertUTF16ToJavaString(env, 109 ConvertUTF16ToJavaString(env,
109 infobar_delegate_->GetButtonLabel( 110 infobar_delegate_->GetButtonLabel(
110 PermissionInfoBarDelegate::BUTTON_CANCEL)), 111 PermissionInfoBarDelegate::BUTTON_CANCEL)),
111 infobar_delegate_->ShouldShowPersistenceToggle()); 112 infobar_delegate_->ShouldShowPersistenceToggle());
112 } 113 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 base::android::ScopedJavaLocalRef<jobject> j_delegate = 163 base::android::ScopedJavaLocalRef<jobject> j_delegate =
163 CreateJavaDelegate(env); 164 CreateJavaDelegate(env);
164 165
165 // Send the Java delegate to the Java PermissionDialogController for display. 166 // Send the Java delegate to the Java PermissionDialogController for display.
166 // The controller takes over lifetime management; when the Java delegate is no 167 // The controller takes over lifetime management; when the Java delegate is no
167 // longer needed it will in turn free the native delegate. 168 // longer needed it will in turn free the native delegate.
168 Java_PermissionDialogController_createDialog(env, j_delegate.obj()); 169 Java_PermissionDialogController_createDialog(env, j_delegate.obj());
169 } 170 }
170 171
171 PermissionDialogDelegate::~PermissionDialogDelegate() {} 172 PermissionDialogDelegate::~PermissionDialogDelegate() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698