| OLD | NEW |
| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 | 421 |
| 422 bool MediaStreamDevicesController::HasUserGesture() const { | 422 bool MediaStreamDevicesController::HasUserGesture() const { |
| 423 return request_.user_gesture; | 423 return request_.user_gesture; |
| 424 } | 424 } |
| 425 | 425 |
| 426 GURL MediaStreamDevicesController::GetRequestingHostname() const { | 426 GURL MediaStreamDevicesController::GetRequestingHostname() const { |
| 427 return request_.security_origin; | 427 return request_.security_origin; |
| 428 } | 428 } |
| 429 | 429 |
| 430 void MediaStreamDevicesController::PermissionGranted() { | 430 void MediaStreamDevicesController::PermissionGranted() { |
| 431 LOG(INFO) << "PeERMISSION GRANTED"; |
| 431 GURL origin(GetSecurityOriginSpec()); | 432 GURL origin(GetSecurityOriginSpec()); |
| 432 if (origin.SchemeIsSecure()) { | 433 if (origin.SchemeIsSecure()) { |
| 433 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", | 434 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", |
| 434 kAllowHttps, kPermissionActionsMax); | 435 kAllowHttps, kPermissionActionsMax); |
| 435 } else { | 436 } else { |
| 436 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", | 437 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", |
| 437 kAllowHttp, kPermissionActionsMax); | 438 kAllowHttp, kPermissionActionsMax); |
| 438 } | 439 } |
| 439 Accept(true); | 440 Accept(true); |
| 440 } | 441 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 } | 677 } |
| 677 | 678 |
| 678 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { | 679 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { |
| 679 #if defined(OS_ANDROID) | 680 #if defined(OS_ANDROID) |
| 680 // Don't approve device requests if the tab was hidden. | 681 // Don't approve device requests if the tab was hidden. |
| 681 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 682 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 682 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 683 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 683 #endif | 684 #endif |
| 684 return true; | 685 return true; |
| 685 } | 686 } |
| OLD | NEW |