Chromium Code Reviews| 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/webrtc/media_stream_devices_controller.h" | 5 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 #if defined(OS_ANDROID) | 604 #if defined(OS_ANDROID) |
| 605 content::ContentViewCore* cvc = | 605 content::ContentViewCore* cvc = |
| 606 content::ContentViewCore::FromWebContents(web_contents_); | 606 content::ContentViewCore::FromWebContents(web_contents_); |
| 607 if (!cvc) | 607 if (!cvc) |
| 608 return false; | 608 return false; |
| 609 | 609 |
| 610 ui::WindowAndroid* window_android = cvc->GetWindowAndroid(); | 610 ui::WindowAndroid* window_android = cvc->GetWindowAndroid(); |
| 611 if (!window_android) | 611 if (!window_android) |
| 612 return false; | 612 return false; |
| 613 | 613 |
| 614 std::string android_permission = | 614 std::vector<std::string> android_permissions; |
| 615 PrefServiceBridge::GetAndroidPermissionForContentSetting(content_type); | 615 PrefServiceBridge::GetAndroidPermissionsForContentSetting( |
| 616 bool android_permission_blocked = false; | 616 content_type, &android_permissions); |
| 617 if (!android_permission.empty()) { | 617 for (std::string android_permission : android_permissions) { |
|
tommi (sloooow) - chröme
2017/02/16 21:42:04
please change to |const std::string& android_permi
Ted C
2017/02/17 21:36:52
Done.
| |
| 618 android_permission_blocked = | 618 if (!window_android->HasPermission(android_permission) && |
| 619 !window_android->HasPermission(android_permission) && | 619 !window_android->CanRequestPermission(android_permission)) { |
| 620 !window_android->CanRequestPermission(android_permission); | 620 return false; |
| 621 } | |
| 621 } | 622 } |
| 622 if (android_permission_blocked) | |
| 623 return false; | |
| 624 | 623 |
| 625 // Don't approve device requests if the tab was hidden. | 624 // Don't approve device requests if the tab was hidden. |
| 626 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 625 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 627 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 626 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 628 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 627 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 629 #endif | 628 #endif |
| 630 return true; | 629 return true; |
| 631 } | 630 } |
| OLD | NEW |