Chromium Code Reviews| 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 IsolatedWorldHumanReadableNameMap& humanReadableNames = isolatedWorldHumanRe adableNames(); | |
| 187 IsolatedWorldHumanReadableNameMap::iterator it = humanReadableNames.find(wor ldId()); | |
|
yurys
2014/08/25 09:22:30
humanReadableNames.get(worldId()) ?
lushnikov
2014/08/27 08:20:26
Done.
| |
| 188 return it == humanReadableNames.end() ? "" : it->value; | |
| 189 } | |
| 190 | |
| 191 void DOMWrapperWorld::setIsolatedWorldHumanReadableName(int worldId, const Strin g& humanReadableName) | |
| 192 { | |
| 193 ASSERT(isIsolatedWorldId(worldId)); | |
| 194 if (!humanReadableName.isEmpty()) | |
|
yurys
2014/08/25 09:22:30
Why do you need this check?
lushnikov
2014/08/27 08:20:26
Done.
| |
| 195 isolatedWorldHumanReadableNames().set(worldId, humanReadableName); | |
| 196 else | |
| 197 isolatedWorldHumanReadableNames().remove(worldId); | |
| 198 } | |
| 199 | |
| 175 typedef HashMap<int, bool> IsolatedWorldContentSecurityPolicyMap; | 200 typedef HashMap<int, bool> IsolatedWorldContentSecurityPolicyMap; |
| 176 static IsolatedWorldContentSecurityPolicyMap& isolatedWorldContentSecurityPolici es() | 201 static IsolatedWorldContentSecurityPolicyMap& isolatedWorldContentSecurityPolici es() |
| 177 { | 202 { |
| 178 ASSERT(isMainThread()); | 203 ASSERT(isMainThread()); |
| 179 DEFINE_STATIC_LOCAL(IsolatedWorldContentSecurityPolicyMap, map, ()); | 204 DEFINE_STATIC_LOCAL(IsolatedWorldContentSecurityPolicyMap, map, ()); |
| 180 return map; | 205 return map; |
| 181 } | 206 } |
| 182 | 207 |
| 183 bool DOMWrapperWorld::isolatedWorldHasContentSecurityPolicy() | 208 bool DOMWrapperWorld::isolatedWorldHasContentSecurityPolicy() |
| 184 { | 209 { |
| 185 ASSERT(this->isIsolatedWorld()); | 210 ASSERT(this->isIsolatedWorld()); |
| 186 IsolatedWorldContentSecurityPolicyMap& policies = isolatedWorldContentSecuri tyPolicies(); | 211 IsolatedWorldContentSecurityPolicyMap& policies = isolatedWorldContentSecuri tyPolicies(); |
| 187 IsolatedWorldContentSecurityPolicyMap::iterator it = policies.find(worldId() ); | 212 IsolatedWorldContentSecurityPolicyMap::iterator it = policies.find(worldId() ); |
| 188 return it == policies.end() ? false : it->value; | 213 return it == policies.end() ? false : it->value; |
| 189 } | 214 } |
| 190 | 215 |
| 191 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S tring& policy) | 216 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S tring& policy) |
| 192 { | 217 { |
| 193 ASSERT(isIsolatedWorldId(worldId)); | 218 ASSERT(isIsolatedWorldId(worldId)); |
| 194 if (!policy.isEmpty()) | 219 if (!policy.isEmpty()) |
| 195 isolatedWorldContentSecurityPolicies().set(worldId, true); | 220 isolatedWorldContentSecurityPolicies().set(worldId, true); |
| 196 else | 221 else |
| 197 isolatedWorldContentSecurityPolicies().remove(worldId); | 222 isolatedWorldContentSecurityPolicies().remove(worldId); |
| 198 } | 223 } |
| 199 | 224 |
| 200 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |