| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 std::string requested_device_id; | 43 std::string requested_device_id; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 typedef std::map<content::MediaStreamType, MediaStreamTypeSettings> | 46 typedef std::map<content::MediaStreamType, MediaStreamTypeSettings> |
| 47 MediaStreamTypeSettingsMap; | 47 MediaStreamTypeSettingsMap; |
| 48 | 48 |
| 49 MediaStreamDevicesController(content::WebContents* web_contents, | 49 MediaStreamDevicesController(content::WebContents* web_contents, |
| 50 const content::MediaStreamRequest& request, | 50 const content::MediaStreamRequest& request, |
| 51 const content::MediaResponseCallback& callback); | 51 const content::MediaResponseCallback& callback); |
| 52 | 52 |
| 53 virtual ~MediaStreamDevicesController(); | 53 ~MediaStreamDevicesController() override; |
| 54 | 54 |
| 55 // TODO(tommi): Clean up all the policy code and integrate with | 55 // TODO(tommi): Clean up all the policy code and integrate with |
| 56 // HostContentSettingsMap instead. This will make creating the UI simpler | 56 // HostContentSettingsMap instead. This will make creating the UI simpler |
| 57 // and the code cleaner. crbug.com/244389. | 57 // and the code cleaner. crbug.com/244389. |
| 58 | 58 |
| 59 // Registers the prefs backing the audio and video policies. | 59 // Registers the prefs backing the audio and video policies. |
| 60 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 60 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 61 | 61 |
| 62 // Public method to be called before creating the MediaStreamInfoBarDelegate. | 62 // Public method to be called before creating the MediaStreamInfoBarDelegate. |
| 63 // This function will check the content settings exceptions and take the | 63 // This function will check the content settings exceptions and take the |
| 64 // corresponding action on exception which matches the request. | 64 // corresponding action on exception which matches the request. |
| 65 bool DismissInfoBarAndTakeActionOnSettings(); | 65 bool DismissInfoBarAndTakeActionOnSettings(); |
| 66 | 66 |
| 67 // Public methods to be called by MediaStreamInfoBarDelegate; | 67 // Public methods to be called by MediaStreamInfoBarDelegate; |
| 68 bool HasAudio() const; | 68 bool HasAudio() const; |
| 69 bool HasVideo() const; | 69 bool HasVideo() const; |
| 70 const std::string& GetSecurityOriginSpec() const; | 70 const std::string& GetSecurityOriginSpec() const; |
| 71 void Accept(bool update_content_setting); | 71 void Accept(bool update_content_setting); |
| 72 void Deny(bool update_content_setting, | 72 void Deny(bool update_content_setting, |
| 73 content::MediaStreamRequestResult result); | 73 content::MediaStreamRequestResult result); |
| 74 | 74 |
| 75 // PermissionBubbleRequest: | 75 // PermissionBubbleRequest: |
| 76 virtual int GetIconID() const override; | 76 int GetIconID() const override; |
| 77 virtual base::string16 GetMessageText() const override; | 77 base::string16 GetMessageText() const override; |
| 78 virtual base::string16 GetMessageTextFragment() const override; | 78 base::string16 GetMessageTextFragment() const override; |
| 79 virtual bool HasUserGesture() const override; | 79 bool HasUserGesture() const override; |
| 80 virtual GURL GetRequestingHostname() const override; | 80 GURL GetRequestingHostname() const override; |
| 81 virtual void PermissionGranted() override; | 81 void PermissionGranted() override; |
| 82 virtual void PermissionDenied() override; | 82 void PermissionDenied() override; |
| 83 virtual void Cancelled() override; | 83 void Cancelled() override; |
| 84 virtual void RequestFinished() override; | 84 void RequestFinished() override; |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 // Returns true if the origin of the request has been granted the media | 87 // Returns true if the origin of the request has been granted the media |
| 88 // access before, otherwise returns false. | 88 // access before, otherwise returns false. |
| 89 bool IsRequestAllowedByDefault() const; | 89 bool IsRequestAllowedByDefault() const; |
| 90 | 90 |
| 91 // Check if any device of the request has been blocked for the origin of the | 91 // Check if any device of the request has been blocked for the origin of the |
| 92 // request and clears |microphone_requested_| or |webcam_requested_| flags if | 92 // request and clears |microphone_requested_| or |webcam_requested_| flags if |
| 93 // they are not allowed anymore. Returns the number of devices that are | 93 // they are not allowed anymore. Returns the number of devices that are |
| 94 // allowed after this step. If the count reaches zero the request can be | 94 // allowed after this step. If the count reaches zero the request can be |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // passed to the tab specific content settings when the permissions have been | 150 // passed to the tab specific content settings when the permissions have been |
| 151 // resolved. Currently only used by MEDIA_DEVICE_AUDIO_CAPTURE and | 151 // resolved. Currently only used by MEDIA_DEVICE_AUDIO_CAPTURE and |
| 152 // MEDIA_DEVICE_VIDEO_CAPTURE since those are the only types that require | 152 // MEDIA_DEVICE_VIDEO_CAPTURE since those are the only types that require |
| 153 // updates in the settings. | 153 // updates in the settings. |
| 154 MediaStreamTypeSettingsMap request_permissions_; | 154 MediaStreamTypeSettingsMap request_permissions_; |
| 155 | 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); | 156 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicesController); |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ | 159 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICES_CONTROLLER_H_ |
| OLD | NEW |