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

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

Issue 2801553002: Remove IsUserAcceptAllowed check from storing media permission decision (Closed)
Patch Set: Remove IsUserAcceptAllowed check from storing permission decision Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 return permission.GetPermissionStatus(denial_reason); 739 return permission.GetPermissionStatus(denial_reason);
740 } 740 }
741 741
742 ContentSetting MediaStreamDevicesController::GetNewSetting( 742 ContentSetting MediaStreamDevicesController::GetNewSetting(
743 ContentSettingsType content_type, 743 ContentSettingsType content_type,
744 ContentSetting old_setting, 744 ContentSetting old_setting,
745 ContentSetting user_decision) const { 745 ContentSetting user_decision) const {
746 DCHECK(user_decision == CONTENT_SETTING_ALLOW || 746 DCHECK(user_decision == CONTENT_SETTING_ALLOW ||
747 user_decision == CONTENT_SETTING_BLOCK); 747 user_decision == CONTENT_SETTING_BLOCK);
748 ContentSetting result = old_setting; 748 ContentSetting result = old_setting;
749 if (old_setting == CONTENT_SETTING_ASK) { 749 if (old_setting == CONTENT_SETTING_ASK)
750 if (user_decision == CONTENT_SETTING_ALLOW && 750 result = user_decision;
751 IsUserAcceptAllowed(content_type)) {
752 result = CONTENT_SETTING_ALLOW;
753 } else if (user_decision == CONTENT_SETTING_BLOCK) {
754 result = CONTENT_SETTING_BLOCK;
755 }
756 }
757 return result; 751 return result;
758 } 752 }
759 753
760 bool MediaStreamDevicesController::IsUserAcceptAllowed( 754 bool MediaStreamDevicesController::IsUserAcceptAllowed(
761 ContentSettingsType content_type) const { 755 ContentSettingsType content_type) const {
762 #if defined(OS_ANDROID) 756 #if defined(OS_ANDROID)
763 content::ContentViewCore* cvc = 757 content::ContentViewCore* cvc =
764 content::ContentViewCore::FromWebContents(web_contents_); 758 content::ContentViewCore::FromWebContents(web_contents_);
765 if (!cvc) 759 if (!cvc)
766 return false; 760 return false;
(...skipping 12 matching lines...) Expand all
779 } 773 }
780 } 774 }
781 775
782 // Don't approve device requests if the tab was hidden. 776 // Don't approve device requests if the tab was hidden.
783 // TODO(qinmin): Add a test for this. http://crbug.com/396869. 777 // TODO(qinmin): Add a test for this. http://crbug.com/396869.
784 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? 778 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video?
785 return web_contents_->GetRenderWidgetHostView()->IsShowing(); 779 return web_contents_->GetRenderWidgetHostView()->IsShowing();
786 #endif 780 #endif
787 return true; 781 return true;
788 } 782 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698