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 22 matching lines...) Expand all Loading... |
33 namespace { | 33 namespace { |
34 | 34 |
35 // Key for querying variations for whether a modal should require a gesture. | 35 // Key for querying variations for whether a modal should require a gesture. |
36 const char kModalParamsUserGestureKey[] = "require_gesture"; | 36 const char kModalParamsUserGestureKey[] = "require_gesture"; |
37 | 37 |
38 } | 38 } |
39 | 39 |
40 // static | 40 // static |
41 void PermissionDialogDelegate::Create( | 41 void PermissionDialogDelegate::Create( |
42 content::WebContents* web_contents, | 42 content::WebContents* web_contents, |
43 content::PermissionType type, | 43 ContentSettingsType type, |
44 const GURL& requesting_frame, | 44 const GURL& requesting_frame, |
45 bool user_gesture, | 45 bool user_gesture, |
46 Profile* profile, | 46 Profile* profile, |
47 const PermissionSetCallback& callback) { | 47 const PermissionSetCallback& callback) { |
48 DCHECK(web_contents); | 48 DCHECK(web_contents); |
49 | 49 |
50 // If we don't have a tab, just act as though the prompt was dismissed. | 50 // If we don't have a tab, just act as though the prompt was dismissed. |
51 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | 51 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); |
52 if (!tab) { | 52 if (!tab) { |
53 callback.Run(false, PermissionAction::DISMISSED); | 53 callback.Run(false, PermissionAction::DISMISSED); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 base::android::ScopedJavaLocalRef<jobject> j_delegate = | 175 base::android::ScopedJavaLocalRef<jobject> j_delegate = |
176 CreateJavaDelegate(env); | 176 CreateJavaDelegate(env); |
177 | 177 |
178 // Send the Java delegate to the Java PermissionDialogController for display. | 178 // Send the Java delegate to the Java PermissionDialogController for display. |
179 // The controller takes over lifetime management; when the Java delegate is no | 179 // The controller takes over lifetime management; when the Java delegate is no |
180 // longer needed it will in turn free the native delegate. | 180 // longer needed it will in turn free the native delegate. |
181 Java_PermissionDialogController_createDialog(env, j_delegate.obj()); | 181 Java_PermissionDialogController_createDialog(env, j_delegate.obj()); |
182 } | 182 } |
183 | 183 |
184 PermissionDialogDelegate::~PermissionDialogDelegate() {} | 184 PermissionDialogDelegate::~PermissionDialogDelegate() {} |
OLD | NEW |