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

Side by Side Diff: chrome/browser/media/webrtc/permission_bubble_media_access_handler.cc

Issue 2463393003: Record permission prompt gesture metrics on Android. (Closed)
Patch Set: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/media/webrtc/permission_bubble_media_access_handler.h" 5 #include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "chrome/browser/media/webrtc/media_permission.h" 10 #include "chrome/browser/media/webrtc/media_permission.h"
(...skipping 10 matching lines...) Expand all
21 21
22 #if BUILDFLAG(ANDROID_JAVA_UI) 22 #if BUILDFLAG(ANDROID_JAVA_UI)
23 #include <vector> 23 #include <vector>
24 24
25 #include "base/bind.h" 25 #include "base/bind.h"
26 #include "base/bind_helpers.h" 26 #include "base/bind_helpers.h"
27 #include "chrome/browser/android/chrome_feature_list.h" 27 #include "chrome/browser/android/chrome_feature_list.h"
28 #include "chrome/browser/media/webrtc/media_stream_infobar_delegate_android.h" 28 #include "chrome/browser/media/webrtc/media_stream_infobar_delegate_android.h"
29 #include "chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.h" 29 #include "chrome/browser/media/webrtc/screen_capture_infobar_delegate_android.h"
30 #include "chrome/browser/permissions/permission_dialog_delegate.h" 30 #include "chrome/browser/permissions/permission_dialog_delegate.h"
31 #include "chrome/browser/permissions/permission_uma_util.h"
31 #include "chrome/browser/permissions/permission_update_infobar_delegate_android. h" 32 #include "chrome/browser/permissions/permission_update_infobar_delegate_android. h"
33 #include "chrome/browser/permissions/permission_util.h"
32 #else 34 #else
33 #include "chrome/browser/permissions/permission_request_manager.h" 35 #include "chrome/browser/permissions/permission_request_manager.h"
34 #endif // BUILDFLAG(ANDROID_JAVA_UI) 36 #endif // BUILDFLAG(ANDROID_JAVA_UI)
35 37
36 #if BUILDFLAG(ANDROID_JAVA_UI) 38 #if BUILDFLAG(ANDROID_JAVA_UI)
37 namespace { 39 namespace {
38 // Callback for the permission update infobar when the site and Chrome 40 // Callback for the permission update infobar when the site and Chrome
39 // permissions are mismatched on Android. 41 // permissions are mismatched on Android.
40 void OnPermissionConflictResolved( 42 void OnPermissionConflictResolved(
41 std::unique_ptr<MediaStreamDevicesController> controller, 43 std::unique_ptr<MediaStreamDevicesController> controller,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 PermissionUpdateInfoBarDelegate::Create( 187 PermissionUpdateInfoBarDelegate::Create(
186 web_contents, content_settings_types, 188 web_contents, content_settings_types,
187 base::Bind( 189 base::Bind(
188 &OnPermissionConflictResolved, base::Passed(&controller))); 190 &OnPermissionConflictResolved, base::Passed(&controller)));
189 } 191 }
190 #endif 192 #endif
191 return; 193 return;
192 } 194 }
193 195
194 #if BUILDFLAG(ANDROID_JAVA_UI) 196 #if BUILDFLAG(ANDROID_JAVA_UI)
197 PermissionUmaUtil::RecordPermissionPromptTypeAndGesture(
198 controller->GetPermissionRequestType(),
199 PermissionUtil::GetGestureType(request.user_gesture));
195 if (PermissionDialogDelegate::ShouldShowDialog(request.user_gesture)) { 200 if (PermissionDialogDelegate::ShouldShowDialog(request.user_gesture)) {
196 PermissionDialogDelegate::CreateMediaStreamDialog(web_contents, 201 PermissionDialogDelegate::CreateMediaStreamDialog(web_contents,
197 std::move(controller)); 202 std::move(controller));
198 } else { 203 } else {
199 MediaStreamInfoBarDelegateAndroid::Create(web_contents, 204 MediaStreamInfoBarDelegateAndroid::Create(web_contents,
200 std::move(controller)); 205 std::move(controller));
201 } 206 }
202 #else 207 #else
203 PermissionRequestManager* permission_request_manager = 208 PermissionRequestManager* permission_request_manager =
204 PermissionRequestManager::FromWebContents(web_contents); 209 PermissionRequestManager::FromWebContents(web_contents);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 277
273 void PermissionBubbleMediaAccessHandler::Observe( 278 void PermissionBubbleMediaAccessHandler::Observe(
274 int type, 279 int type,
275 const content::NotificationSource& source, 280 const content::NotificationSource& source,
276 const content::NotificationDetails& details) { 281 const content::NotificationDetails& details) {
277 DCHECK_CURRENTLY_ON(BrowserThread::UI); 282 DCHECK_CURRENTLY_ON(BrowserThread::UI);
278 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type); 283 DCHECK_EQ(content::NOTIFICATION_WEB_CONTENTS_DESTROYED, type);
279 284
280 pending_requests_.erase(content::Source<content::WebContents>(source).ptr()); 285 pending_requests_.erase(content::Source<content::WebContents>(source).ptr());
281 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698