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 |
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" |
14 #include "content/public/browser/web_contents_delegate.h" | 15 #include "content/public/browser/web_contents_delegate.h" |
15 | 16 |
16 class Profile; | 17 class Profile; |
17 class TabSpecificContentSettings; | 18 class TabSpecificContentSettings; |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 class WebContents; | 21 class WebContents; |
21 } | 22 } |
22 | 23 |
23 namespace user_prefs { | 24 namespace user_prefs { |
(...skipping 10 matching lines...) Expand all Loading... |
34 | 35 |
35 // Registers the prefs backing the audio and video policies. | 36 // Registers the prefs backing the audio and video policies. |
36 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 37 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
37 | 38 |
38 bool IsAllowedForAudio() const; | 39 bool IsAllowedForAudio() const; |
39 bool IsAllowedForVideo() const; | 40 bool IsAllowedForVideo() const; |
40 bool IsAskingForAudio() const; | 41 bool IsAskingForAudio() const; |
41 bool IsAskingForVideo() const; | 42 bool IsAskingForVideo() const; |
42 base::string16 GetMessageText() const; | 43 base::string16 GetMessageText() const; |
43 | 44 |
| 45 // Returns the PermissionsType associated with the provided |
| 46 // ContentSettingsType. |type| must be a media stream type. |
| 47 content::PermissionType GetPermissionTypeForContentSettingsType( |
| 48 ContentSettingsType content_type) const; |
| 49 |
44 // Forces the permissions to be denied (without being persisted) regardless | 50 // Forces the permissions to be denied (without being persisted) regardless |
45 // of what the previous state was. If the user had previously allowed the | 51 // 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 | 52 // site video or audio access, this ignores that and informs the site it was |
47 // denied. | 53 // denied. |
48 // | 54 // |
49 // This differs from PermissionGranted/PermissionDenied as they only operate | 55 // This differs from PermissionGranted/PermissionDenied as they only operate |
50 // on the permissions if they are in the ASK state. | 56 // on the permissions if they are in the ASK state. |
51 void ForcePermissionDeniedTemporarily(); | 57 void ForcePermissionDeniedTemporarily(); |
52 | 58 |
| 59 // Calls PermissionGranted, temporarily setting persist_permission_changes_ to |
| 60 // |persist|. The boolean will only ever be false if the persistence toggle |
| 61 // is displayed and switched off for a single permission. |
| 62 void PermissionGranted(bool persist); |
| 63 |
| 64 // Calls PermissionDenied, temporarily setting persist_permission_changes_ to |
| 65 // |persist|. The boolean will only ever be false if the persistence toggle |
| 66 // is displayed and switched off for a single permission. |
| 67 void PermissionDenied(bool persist); |
| 68 |
53 // Answers a permission request with (possibly) different values for | 69 // Answers a permission request with (possibly) different values for |
54 // |audio_accepted| and |video_accepted|. Intended for use from | 70 // |audio_accepted| and |video_accepted|. Intended for use from |
55 // MediaStreamInfobarDelegateAndroid. | 71 // MediaStreamInfobarDelegateAndroid. |
56 // TODO(tsergeant): Remove this by refactoring Android to use | 72 // TODO(tsergeant): Remove this by refactoring Android to use |
57 // PermissionRequest instead of a custom infobar delegate. | 73 // PermissionRequest instead of a custom infobar delegate. |
58 void GroupedRequestFinished(bool audio_accepted, bool video_accepted); | 74 void GroupedRequestFinished(bool audio_accepted, bool video_accepted); |
59 | 75 |
60 // PermissionRequest: | 76 // PermissionRequest: |
61 int GetIconId() const override; | 77 int GetIconId() const override; |
62 base::string16 GetMessageTextFragment() const override; | 78 base::string16 GetMessageTextFragment() const override; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // audio/video devices was granted or not. | 147 // audio/video devices was granted or not. |
132 content::MediaResponseCallback callback_; | 148 content::MediaResponseCallback callback_; |
133 | 149 |
134 // Whether the permissions granted or denied by the user should be persisted. | 150 // Whether the permissions granted or denied by the user should be persisted. |
135 bool persist_permission_changes_; | 151 bool persist_permission_changes_; |
136 | 152 |
137 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); | 153 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); |
138 }; | 154 }; |
139 | 155 |
140 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 156 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
OLD | NEW |