Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / media / media_permission.h
blobdfd01cbbb686deb7b943703607121e97a60be98d
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_PERMISSION_H_
6 #define CHROME_BROWSER_MEDIA_MEDIA_PERMISSION_H_
8 #include <string>
10 #include "components/content_settings/core/common/content_settings.h"
11 #include "components/content_settings/core/common/content_settings_types.h"
12 #include "content/public/common/media_stream_request.h"
13 #include "url/gurl.h"
15 class Profile;
17 // Represents a permission for microphone/camera access.
18 class MediaPermission {
19 public:
20 MediaPermission(ContentSettingsType content_type,
21 content::MediaStreamRequestType request_type,
22 const GURL& requesting_origin,
23 const GURL& embedding_origin,
24 Profile* profile);
26 // Returns the status of the permission. If the setting is
27 // CONTENT_SETTING_BLOCK, |denial_reason| will output the reason for it being
28 // blocked.
29 ContentSetting GetPermissionStatus(
30 content::MediaStreamRequestResult* denial_reason) const;
32 // Returns the status of the permission as with GetPermissionStatus but also
33 // checks that the specified |device_id| is an available device.
34 ContentSetting GetPermissionStatusWithDeviceRequired(
35 const std::string& device_id,
36 content::MediaStreamRequestResult* denial_reason) const;
38 private:
39 ContentSetting GetStoredContentSetting() const;
40 bool HasAvailableDevices(const std::string& device_id) const;
42 const ContentSettingsType content_type_;
43 const content::MediaStreamRequestType request_type_;
44 const GURL requesting_origin_;
45 const GURL embedding_origin_;
46 const std::string device_id_;
47 Profile* const profile_;
49 DISALLOW_COPY_AND_ASSIGN(MediaPermission);
52 #endif // CHROME_BROWSER_MEDIA_MEDIA_PERMISSION_H_