| OLD | NEW |
| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const GURL& requesting_frame, | 26 const GURL& requesting_frame, |
| 27 bool user_gesture, | 27 bool user_gesture, |
| 28 const BrowserPermissionCallback& callback) override; | 28 const BrowserPermissionCallback& callback) override; |
| 29 | 29 |
| 30 // TODO(xhwang): GURL.GetOrigin() shouldn't be used as the origin. Need to | 30 // TODO(xhwang): GURL.GetOrigin() shouldn't be used as the origin. Need to |
| 31 // refactor to use url::Origin. crbug.com/527149 is filed for this. | 31 // refactor to use url::Origin. crbug.com/527149 is filed for this. |
| 32 ContentSetting GetPermissionStatus( | 32 ContentSetting GetPermissionStatus( |
| 33 const GURL& requesting_origin, | 33 const GURL& requesting_origin, |
| 34 const GURL& embedding_origin) const override; | 34 const GURL& embedding_origin) const override; |
| 35 | 35 |
| 36 // For Pepper request, insecure origins are allowed to be persisted, hence we |
| 37 // can't just call GetPermissionStatus when the requesting origin is insecure. |
| 38 // Please see crbug.com/512301. |
| 39 ContentSetting GetPermissionStatusForPepper( |
| 40 const GURL& requesting_origin, |
| 41 const GURL& embedding_origin) const; |
| 42 |
| 36 void ResetPermission(const GURL& requesting_origin, | 43 void ResetPermission(const GURL& requesting_origin, |
| 37 const GURL& embedding_origin) override; | 44 const GURL& embedding_origin) override; |
| 38 | 45 |
| 39 void CancelPermissionRequest(content::WebContents* web_contents, | 46 void CancelPermissionRequest(content::WebContents* web_contents, |
| 40 const PermissionRequestID& id) override; | 47 const PermissionRequestID& id) override; |
| 41 | 48 |
| 42 private: | 49 private: |
| 50 ContentSetting GetPermissionStatusInternal(const GURL& requesting_origin, |
| 51 const GURL& embedding_origin, |
| 52 bool is_pepper_request) const; |
| 53 |
| 43 // PermissionContextBase: | 54 // PermissionContextBase: |
| 44 bool IsRestrictedToSecureOrigins() const override; | 55 bool IsRestrictedToSecureOrigins() const override; |
| 45 | 56 |
| 46 ContentSettingsType content_settings_type_; | 57 ContentSettingsType content_settings_type_; |
| 47 | 58 |
| 48 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContext); | 59 DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContext); |
| 49 }; | 60 }; |
| 50 | 61 |
| 51 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ | 62 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_DEVICE_PERMISSION_CONTEXT_H_ |
| OLD | NEW |