OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(int worldId, PassRefPtr<Sec
urityOrigin> securityOrigin) | 166 void DOMWrapperWorld::setIsolatedWorldSecurityOrigin(int worldId, PassRefPtr<Sec
urityOrigin> securityOrigin) |
167 { | 167 { |
168 ASSERT(isIsolatedWorldId(worldId)); | 168 ASSERT(isIsolatedWorldId(worldId)); |
169 if (securityOrigin) | 169 if (securityOrigin) |
170 isolatedWorldSecurityOrigins().set(worldId, securityOrigin); | 170 isolatedWorldSecurityOrigins().set(worldId, securityOrigin); |
171 else | 171 else |
172 isolatedWorldSecurityOrigins().remove(worldId); | 172 isolatedWorldSecurityOrigins().remove(worldId); |
173 } | 173 } |
174 | 174 |
| 175 typedef HashMap<int, String > IsolatedWorldHumanReadableNameMap; |
| 176 static IsolatedWorldHumanReadableNameMap& isolatedWorldHumanReadableNames() |
| 177 { |
| 178 ASSERT(isMainThread()); |
| 179 DEFINE_STATIC_LOCAL(IsolatedWorldHumanReadableNameMap, map, ()); |
| 180 return map; |
| 181 } |
| 182 |
| 183 String DOMWrapperWorld::isolatedWorldHumanReadableName() |
| 184 { |
| 185 ASSERT(this->isIsolatedWorld()); |
| 186 return isolatedWorldHumanReadableNames().get(worldId()); |
| 187 } |
| 188 |
| 189 void DOMWrapperWorld::setIsolatedWorldHumanReadableName(int worldId, const Strin
g& humanReadableName) |
| 190 { |
| 191 ASSERT(isIsolatedWorldId(worldId)); |
| 192 isolatedWorldHumanReadableNames().set(worldId, humanReadableName); |
| 193 } |
| 194 |
175 typedef HashMap<int, bool> IsolatedWorldContentSecurityPolicyMap; | 195 typedef HashMap<int, bool> IsolatedWorldContentSecurityPolicyMap; |
176 static IsolatedWorldContentSecurityPolicyMap& isolatedWorldContentSecurityPolici
es() | 196 static IsolatedWorldContentSecurityPolicyMap& isolatedWorldContentSecurityPolici
es() |
177 { | 197 { |
178 ASSERT(isMainThread()); | 198 ASSERT(isMainThread()); |
179 DEFINE_STATIC_LOCAL(IsolatedWorldContentSecurityPolicyMap, map, ()); | 199 DEFINE_STATIC_LOCAL(IsolatedWorldContentSecurityPolicyMap, map, ()); |
180 return map; | 200 return map; |
181 } | 201 } |
182 | 202 |
183 bool DOMWrapperWorld::isolatedWorldHasContentSecurityPolicy() | 203 bool DOMWrapperWorld::isolatedWorldHasContentSecurityPolicy() |
184 { | 204 { |
185 ASSERT(this->isIsolatedWorld()); | 205 ASSERT(this->isIsolatedWorld()); |
186 IsolatedWorldContentSecurityPolicyMap& policies = isolatedWorldContentSecuri
tyPolicies(); | 206 IsolatedWorldContentSecurityPolicyMap& policies = isolatedWorldContentSecuri
tyPolicies(); |
187 IsolatedWorldContentSecurityPolicyMap::iterator it = policies.find(worldId()
); | 207 IsolatedWorldContentSecurityPolicyMap::iterator it = policies.find(worldId()
); |
188 return it == policies.end() ? false : it->value; | 208 return it == policies.end() ? false : it->value; |
189 } | 209 } |
190 | 210 |
191 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S
tring& policy) | 211 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S
tring& policy) |
192 { | 212 { |
193 ASSERT(isIsolatedWorldId(worldId)); | 213 ASSERT(isIsolatedWorldId(worldId)); |
194 if (!policy.isEmpty()) | 214 if (!policy.isEmpty()) |
195 isolatedWorldContentSecurityPolicies().set(worldId, true); | 215 isolatedWorldContentSecurityPolicies().set(worldId, true); |
196 else | 216 else |
197 isolatedWorldContentSecurityPolicies().remove(worldId); | 217 isolatedWorldContentSecurityPolicies().remove(worldId); |
198 } | 218 } |
199 | 219 |
200 } // namespace blink | 220 } // namespace blink |
OLD | NEW |