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

Side by Side Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 185863003: [Media] Add user gesture reporting for API calls to midi and media streams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test merge Created 6 years, 9 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/media_stream_devices_controller.h" 5 #include "chrome/browser/media/media_stream_devices_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 base::string16 MediaStreamDevicesController::GetMessageTextFragment() const { 381 base::string16 MediaStreamDevicesController::GetMessageTextFragment() const {
382 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO_PERMISSION_FRAGMENT; 382 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO_PERMISSION_FRAGMENT;
383 if (!HasAudio()) 383 if (!HasAudio())
384 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; 384 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT;
385 else if (!HasVideo()) 385 else if (!HasVideo())
386 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; 386 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT;
387 return l10n_util::GetStringUTF16(message_id); 387 return l10n_util::GetStringUTF16(message_id);
388 } 388 }
389 389
390 bool MediaStreamDevicesController::HasUserGesture() const { 390 bool MediaStreamDevicesController::HasUserGesture() const {
391 // TODO(gbillock): plumb this through 391 return request_.user_gesture;
392 return false;
393 } 392 }
394 393
395 GURL MediaStreamDevicesController::GetRequestingHostname() const { 394 GURL MediaStreamDevicesController::GetRequestingHostname() const {
396 return request_.security_origin; 395 return request_.security_origin;
397 } 396 }
398 397
399 void MediaStreamDevicesController::PermissionGranted() { 398 void MediaStreamDevicesController::PermissionGranted() {
400 GURL origin(GetSecurityOriginSpec()); 399 GURL origin(GetSecurityOriginSpec());
401 if (origin.SchemeIsSecure()) { 400 if (origin.SchemeIsSecure()) {
402 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", 401 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions",
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 it->second.permission == MEDIA_ALLOWED); 637 it->second.permission == MEDIA_ALLOWED);
639 } 638 }
640 639
641 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() 640 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed()
642 const { 641 const {
643 MediaStreamTypeSettingsMap::const_iterator it = 642 MediaStreamTypeSettingsMap::const_iterator it =
644 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); 643 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE);
645 return (it != request_permissions_.end() && 644 return (it != request_permissions_.end() &&
646 it->second.permission == MEDIA_ALLOWED); 645 it->second.permission == MEDIA_ALLOWED);
647 } 646 }
OLDNEW
« no previous file with comments | « chrome/browser/media/chrome_midi_permission_context.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698