| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "platform/weborigin/SecurityOrigin.h" | 35 #include "platform/weborigin/SecurityOrigin.h" |
| 36 #include "public/web/WebDocument.h" | 36 #include "public/web/WebDocument.h" |
| 37 #include "public/web/WebPermissionClient.h" | 37 #include "public/web/WebPermissionClient.h" |
| 38 #include "web/WebLocalFrameImpl.h" | 38 #include "web/WebLocalFrameImpl.h" |
| 39 | 39 |
| 40 using namespace WebCore; | 40 using namespace WebCore; |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class ContextFeaturesCache : public DocumentSupplement { | 44 class ContextFeaturesCache FINAL : public NoBaseWillBeGarbageCollectedFinalized<
ContextFeaturesCache>, public DocumentSupplement { |
| 45 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ContextFeaturesCache); |
| 45 public: | 46 public: |
| 46 class Entry { | 47 class Entry { |
| 47 public: | 48 public: |
| 48 enum Value { | 49 enum Value { |
| 49 IsEnabled, | 50 IsEnabled, |
| 50 IsDisabled, | 51 IsDisabled, |
| 51 NeedsRefresh | 52 NeedsRefresh |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 Entry() | 55 Entry() |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const char* ContextFeaturesCache::supplementName() | 101 const char* ContextFeaturesCache::supplementName() |
| 101 { | 102 { |
| 102 return "ContextFeaturesCache"; | 103 return "ContextFeaturesCache"; |
| 103 } | 104 } |
| 104 | 105 |
| 105 ContextFeaturesCache& ContextFeaturesCache::from(Document& document) | 106 ContextFeaturesCache& ContextFeaturesCache::from(Document& document) |
| 106 { | 107 { |
| 107 ContextFeaturesCache* cache = static_cast<ContextFeaturesCache*>(DocumentSup
plement::from(document, supplementName())); | 108 ContextFeaturesCache* cache = static_cast<ContextFeaturesCache*>(DocumentSup
plement::from(document, supplementName())); |
| 108 if (!cache) { | 109 if (!cache) { |
| 109 cache = new ContextFeaturesCache(); | 110 cache = new ContextFeaturesCache(); |
| 110 DocumentSupplement::provideTo(document, supplementName(), adoptPtr(cache
)); | 111 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe
Noop(cache)); |
| 111 } | 112 } |
| 112 | 113 |
| 113 return *cache; | 114 return *cache; |
| 114 } | 115 } |
| 115 | 116 |
| 116 void ContextFeaturesCache::validateAgainst(Document* document) | 117 void ContextFeaturesCache::validateAgainst(Document* document) |
| 117 { | 118 { |
| 118 String currentDomain = document->securityOrigin()->domain(); | 119 String currentDomain = document->securityOrigin()->domain(); |
| 119 if (currentDomain == m_domain) | 120 if (currentDomain == m_domain) |
| 120 return; | 121 return; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 150 case ContextFeatures::MutationEvents: | 151 case ContextFeatures::MutationEvents: |
| 151 return frame->permissionClient()->allowMutationEvents(defaultValue); | 152 return frame->permissionClient()->allowMutationEvents(defaultValue); |
| 152 case ContextFeatures::PushState: | 153 case ContextFeatures::PushState: |
| 153 return frame->permissionClient()->allowPushState(); | 154 return frame->permissionClient()->allowPushState(); |
| 154 default: | 155 default: |
| 155 return defaultValue; | 156 return defaultValue; |
| 156 } | 157 } |
| 157 } | 158 } |
| 158 | 159 |
| 159 } // namespace blink | 160 } // namespace blink |
| OLD | NEW |