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

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

Issue 2463393003: Record permission prompt gesture metrics on Android. (Closed)
Patch Set: Address 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_string.h" 10 #include "base/android/jni_string.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Dispatch the dialog to Java, which manages the lifetime of this object. 49 // Dispatch the dialog to Java, which manages the lifetime of this object.
50 new PermissionDialogDelegate( 50 new PermissionDialogDelegate(
51 web_contents, 51 web_contents,
52 PermissionInfoBarDelegate::CreateDelegate( 52 PermissionInfoBarDelegate::CreateDelegate(
53 type, requesting_frame, user_gesture, profile, callback)); 53 type, requesting_frame, user_gesture, profile, callback));
54 } 54 }
55 55
56 // static 56 // static
57 void PermissionDialogDelegate::CreateMediaStreamDialog( 57 void PermissionDialogDelegate::CreateMediaStreamDialog(
58 content::WebContents* web_contents, 58 content::WebContents* web_contents,
59 bool user_gesture,
59 std::unique_ptr<MediaStreamDevicesController> controller) { 60 std::unique_ptr<MediaStreamDevicesController> controller) {
60 // Called this way because the infobar delegate has a private destructor. 61 // Called this way because the infobar delegate has a private destructor.
61 std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate; 62 std::unique_ptr<PermissionInfoBarDelegate> infobar_delegate;
62 infobar_delegate.reset(new MediaStreamInfoBarDelegateAndroid( 63 infobar_delegate.reset(new MediaStreamInfoBarDelegateAndroid(
63 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 64 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
65 user_gesture,
64 std::move(controller))); 66 std::move(controller)));
65 67
66 // Dispatch the dialog to Java, which manages the lifetime of this object. 68 // Dispatch the dialog to Java, which manages the lifetime of this object.
67 new PermissionDialogDelegate(web_contents, std::move(infobar_delegate)); 69 new PermissionDialogDelegate(web_contents, std::move(infobar_delegate));
68 } 70 }
69 71
70 // static 72 // static
71 bool PermissionDialogDelegate::ShouldShowDialog(bool has_user_gesture) { 73 bool PermissionDialogDelegate::ShouldShowDialog(bool has_user_gesture) {
72 if (!base::FeatureList::IsEnabled(features::kModalPermissionPrompts)) 74 if (!base::FeatureList::IsEnabled(features::kModalPermissionPrompts))
73 return false; 75 return false;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 base::android::ScopedJavaLocalRef<jobject> j_delegate = 159 base::android::ScopedJavaLocalRef<jobject> j_delegate =
158 CreateJavaDelegate(env); 160 CreateJavaDelegate(env);
159 161
160 // Send the Java delegate to the Java PermissionDialogController for display. 162 // Send the Java delegate to the Java PermissionDialogController for display.
161 // The controller takes over lifetime management; when the Java delegate is no 163 // The controller takes over lifetime management; when the Java delegate is no
162 // longer needed it will in turn free the native delegate. 164 // longer needed it will in turn free the native delegate.
163 Java_PermissionDialogController_createDialog(env, j_delegate.obj()); 165 Java_PermissionDialogController_createDialog(env, j_delegate.obj());
164 } 166 }
165 167
166 PermissionDialogDelegate::~PermissionDialogDelegate() {} 168 PermissionDialogDelegate::~PermissionDialogDelegate() {}
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_dialog_delegate.h ('k') | chrome/browser/permissions/permission_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698