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