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 CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Returns true if microphone access is allowed for |origin|. Used to | 61 // Returns true if microphone access is allowed for |origin|. Used to |
62 // determine what level of authorization is given to |origin| to access | 62 // determine what level of authorization is given to |origin| to access |
63 // resource metadata. | 63 // resource metadata. |
64 virtual bool AllowMicAccess(const GURL& origin) = 0; | 64 virtual bool AllowMicAccess(const GURL& origin) = 0; |
65 | 65 |
66 // Returns true if web camera access is allowed for |origin|. Used to | 66 // Returns true if web camera access is allowed for |origin|. Used to |
67 // determine what level of authorization is given to |origin| to access | 67 // determine what level of authorization is given to |origin| to access |
68 // resource metadata. | 68 // resource metadata. |
69 virtual bool AllowCameraAccess(const GURL& origin) = 0; | 69 virtual bool AllowCameraAccess(const GURL& origin) = 0; |
70 | 70 |
71 // Returns a random salt string that is used for creating media device IDs. | 71 // Returns a callback that can be invoked to get a random salt |
72 // The salt should be stored in the current user profile and should be reset | 72 // string that is used for creating media device IDs. The salt |
73 // if cookies are cleared. Returns an empty string per default. | 73 // should be stored in the current user profile and should be reset |
74 // TODO(perkj): Make this method pure virtual when crbug/315022 is fixed. | 74 // if cookies are cleared. The default is an empty string. |
75 virtual std::string GetMediaDeviceIDSalt(); | 75 // |
| 76 // It is safe to hold on to the callback returned and use it without |
| 77 // regard to the lifetime of ResourceContext, although in general |
| 78 // you should not use it long after the profile has been destroyed. |
| 79 // |
| 80 // TODO(joi): We don't think it should be unnecessary to use this |
| 81 // after ResourceContext goes away. There is likely an underying bug |
| 82 // in the lifetime of ProfileIOData vs. ResourceProcessHost, where |
| 83 // sometimes ProfileIOData has gone away before RPH has finished |
| 84 // being torn down (on the IO thread). The current interface that |
| 85 // allows using the salt object after ResourceContext has gone away |
| 86 // was put in place to fix http://crbug.com/341211 but I intend to |
| 87 // try to figure out how the lifetime should be fixed properly. The |
| 88 // original interface was just a method that returns a string. |
| 89 // |
| 90 // TODO(perkj): Make this method pure virtual when crbug/315022 is |
| 91 // fixed. |
| 92 typedef base::Callback<std::string()> SaltCallback; |
| 93 virtual SaltCallback GetMediaDeviceIDSalt(); |
76 }; | 94 }; |
77 | 95 |
78 } // namespace content | 96 } // namespace content |
79 | 97 |
80 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ | 98 #endif // CONTENT_PUBLIC_BROWSER_RESOURCE_CONTEXT_H_ |
OLD | NEW |