| 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 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 // Registers the prefs backing the audio and video policies. | 35 // Registers the prefs backing the audio and video policies. |
| 36 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 36 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 37 | 37 |
| 38 bool IsAllowedForAudio() const; | 38 bool IsAllowedForAudio() const; |
| 39 bool IsAllowedForVideo() const; | 39 bool IsAllowedForVideo() const; |
| 40 bool IsAskingForAudio() const; | 40 bool IsAskingForAudio() const; |
| 41 bool IsAskingForVideo() const; | 41 bool IsAskingForVideo() const; |
| 42 base::string16 GetMessageText() const; | 42 base::string16 GetMessageText() const; |
| 43 | 43 |
| 44 // Returns the PermissionsType associated with the provided |
| 45 // ContentSettingsType. |content_type| must be a media stream type. |
| 46 content::PermissionType GetPermissionTypeForContentSettingsType( |
| 47 ContentSettingsType content_type) const; |
| 48 |
| 44 // Forces the permissions to be denied (without being persisted) regardless | 49 // Forces the permissions to be denied (without being persisted) regardless |
| 45 // of what the previous state was. If the user had previously allowed the | 50 // of what the previous state was. If the user had previously allowed the |
| 46 // site video or audio access, this ignores that and informs the site it was | 51 // site video or audio access, this ignores that and informs the site it was |
| 47 // denied. | 52 // denied. |
| 48 // | 53 // |
| 49 // This differs from PermissionGranted/PermissionDenied as they only operate | 54 // This differs from PermissionGranted/PermissionDenied as they only operate |
| 50 // on the permissions if they are in the ASK state. | 55 // on the permissions if they are in the ASK state. |
| 51 void ForcePermissionDeniedTemporarily(); | 56 void ForcePermissionDeniedTemporarily(); |
| 52 | 57 |
| 53 // Answers a permission request with (possibly) different values for | 58 // Answers a permission request with (possibly) different values for |
| 54 // |audio_accepted| and |video_accepted|. Intended for use from | 59 // |audio_accepted| and |video_accepted|. Intended for use from |
| 55 // MediaStreamInfobarDelegateAndroid. | 60 // MediaStreamInfobarDelegateAndroid. |
| 56 // TODO(tsergeant): Remove this by refactoring Android to use | 61 // TODO(tsergeant): Remove this by refactoring Android to use |
| 57 // PermissionRequest instead of a custom infobar delegate. | 62 // PermissionRequest instead of a custom infobar delegate. |
| 58 void GroupedRequestFinished(bool audio_accepted, bool video_accepted); | 63 void GroupedRequestFinished(bool audio_accepted, bool video_accepted); |
| 59 | 64 |
| 65 bool persist() const { return persist_; } |
| 66 void set_persist(bool persist) { persist_ = persist; } |
| 67 |
| 60 // PermissionRequest: | 68 // PermissionRequest: |
| 61 int GetIconId() const override; | 69 int GetIconId() const override; |
| 62 base::string16 GetMessageTextFragment() const override; | 70 base::string16 GetMessageTextFragment() const override; |
| 63 GURL GetOrigin() const override; | 71 GURL GetOrigin() const override; |
| 64 void PermissionGranted() override; | 72 void PermissionGranted() override; |
| 65 void PermissionDenied() override; | 73 void PermissionDenied() override; |
| 66 void Cancelled() override; | 74 void Cancelled() override; |
| 67 void RequestFinished() override; | 75 void RequestFinished() override; |
| 68 PermissionRequestType GetPermissionRequestType() const override; | 76 PermissionRequestType GetPermissionRequestType() const override; |
| 69 | 77 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 TabSpecificContentSettings* content_settings_; | 133 TabSpecificContentSettings* content_settings_; |
| 126 | 134 |
| 127 // The original request for access to devices. | 135 // The original request for access to devices. |
| 128 const content::MediaStreamRequest request_; | 136 const content::MediaStreamRequest request_; |
| 129 | 137 |
| 130 // The callback that needs to be Run to notify WebRTC of whether access to | 138 // The callback that needs to be Run to notify WebRTC of whether access to |
| 131 // audio/video devices was granted or not. | 139 // audio/video devices was granted or not. |
| 132 content::MediaResponseCallback callback_; | 140 content::MediaResponseCallback callback_; |
| 133 | 141 |
| 134 // Whether the permissions granted or denied by the user should be persisted. | 142 // Whether the permissions granted or denied by the user should be persisted. |
| 135 bool persist_permission_changes_; | 143 bool persist_; |
| 136 | 144 |
| 137 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); | 145 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); |
| 138 }; | 146 }; |
| 139 | 147 |
| 140 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 148 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| OLD | NEW |