Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/media/media_stream_device_permission_context.h

Issue 1726323002: Have Permission{Manager,Service} use Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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_DEVICE_PERMISSION_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_
6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/permissions/permission_context_base.h" 9 #include "chrome/browser/permissions/permission_context_base.h"
10 #include "components/content_settings/core/common/content_settings_types.h" 10 #include "components/content_settings/core/common/content_settings_types.h"
11 #include "content/public/browser/permission_type.h" 11 #include "content/public/browser/permission_type.h"
12 12
13 // Common class which handles the mic and camera permissions. 13 // Common class which handles the mic and camera permissions.
14 // MediaStreamMicPermissionContextFactory and 14 // MediaStreamMicPermissionContextFactory and
15 // MediaStreamCameraPermissionContextFactory will instantiate this with 15 // MediaStreamCameraPermissionContextFactory will instantiate this with
16 // corresponding |permission_type|. 16 // corresponding |permission_type|.
17 class MediaStreamDevicePermissionContext : public PermissionContextBase { 17 class MediaStreamDevicePermissionContext : public PermissionContextBase {
18 public: 18 public:
19 MediaStreamDevicePermissionContext( 19 MediaStreamDevicePermissionContext(
20 Profile* profile, 20 Profile* profile,
21 const content::PermissionType permission_type, 21 const content::PermissionType permission_type,
22 const ContentSettingsType content_settings_type); 22 const ContentSettingsType content_settings_type);
23 ~MediaStreamDevicePermissionContext() override; 23 ~MediaStreamDevicePermissionContext() override;
24 24
25 // PermissionContextBase: 25 // PermissionContextBase:
26 void RequestPermission(content::WebContents* web_contents, 26 void RequestPermission(content::WebContents* web_contents,
27 const PermissionRequestID& id, 27 const PermissionRequestID& id,
28 const GURL& requesting_frame, 28 const url::Origin& requesting_frame,
29 const BrowserPermissionCallback& callback) override; 29 const BrowserPermissionCallback& callback) override;
30 30
31 // TODO(xhwang): GURL.GetOrigin() shouldn't be used as the origin. Need to
32 // refactor to use url::Origin. crbug.com/527149 is filed for this.
33 ContentSetting GetPermissionStatus( 31 ContentSetting GetPermissionStatus(
34 const GURL& requesting_origin, 32 const url::Origin& requesting_origin,
35 const GURL& embedding_origin) const override; 33 const url::Origin& embedding_origin) const override;
36 34
37 // For Pepper request, insecure origins are allowed to be persisted, hence we 35 // For Pepper request, insecure origins are allowed to be persisted, hence we
38 // can't just call GetPermissionStatus when the requesting origin is insecure. 36 // can't just call GetPermissionStatus when the requesting origin is insecure.
39 // TODO(raymes): Remove this after crbug.com/526324 is fixed. 37 // TODO(raymes): Remove this after crbug.com/526324 is fixed.
40 ContentSetting GetPermissionStatusAllowingInsecureForPepper( 38 ContentSetting GetPermissionStatusAllowingInsecureForPepper(
41 const GURL& requesting_origin, 39 const url::Origin& requesting_origin,
42 const GURL& embedding_origin) const; 40 const url::Origin& embedding_origin) const;
43 41
44 void ResetPermission(const GURL& requesting_origin, 42 void ResetPermission(const url::Origin& requesting_origin,
45 const GURL& embedding_origin) override; 43 const url::Origin& embedding_origin) override;
46 44
47 void CancelPermissionRequest(content::WebContents* web_contents, 45 void CancelPermissionRequest(content::WebContents* web_contents,
48 const PermissionRequestID& id) override; 46 const PermissionRequestID& id) override;
49 47
50 private: 48 private:
51 ContentSetting GetPermissionStatusInternal(const GURL& requesting_origin, 49 ContentSetting GetPermissionStatusInternal(
52 const GURL& embedding_origin, 50 const url::Origin& requesting_origin,
53 bool is_pepper_request) const; 51 const url::Origin& embedding_origin,
52 bool is_pepper_request) const;
54 53
55 // PermissionContextBase: 54 // PermissionContextBase:
56 bool IsRestrictedToSecureOrigins() const override; 55 bool IsRestrictedToSecureOrigins() const override;
57 56
58 ContentSettingsType content_settings_type_; 57 ContentSettingsType content_settings_type_;
59 58
60 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContext); 59 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContext);
61 }; 60 };
62 61
63 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ 62 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_
OLDNEW
« no previous file with comments | « chrome/browser/media/media_permission.cc ('k') | chrome/browser/media/media_stream_device_permission_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698