| 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 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 class ContextFeaturesClient { | 78 class ContextFeaturesClient { |
| 79 WTF_MAKE_FAST_ALLOCATED; | 79 WTF_MAKE_FAST_ALLOCATED; |
| 80 public: | 80 public: |
| 81 static ContextFeaturesClient* empty(); | 81 static ContextFeaturesClient* empty(); |
| 82 | 82 |
| 83 virtual ~ContextFeaturesClient() { } | 83 virtual ~ContextFeaturesClient() { } |
| 84 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool default
Value) { return defaultValue; } | 84 virtual bool isEnabled(Document*, ContextFeatures::FeatureType, bool default
Value) { return defaultValue; } |
| 85 virtual void urlDidChange(Document*) { } | 85 virtual void urlDidChange(Document*) { } |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 void provideContextFeaturesTo(Page*, ContextFeaturesClient*); | 88 void provideContextFeaturesTo(Page&, ContextFeaturesClient*); |
| 89 void provideContextFeaturesToDocumentFrom(Document*, Page*); | 89 void provideContextFeaturesToDocumentFrom(Document&, Page&); |
| 90 | 90 |
| 91 inline PassRefPtr<ContextFeatures> ContextFeatures::create(ContextFeaturesClient
* client) | 91 inline PassRefPtr<ContextFeatures> ContextFeatures::create(ContextFeaturesClient
* client) |
| 92 { | 92 { |
| 93 return adoptRef(new ContextFeatures(client)); | 93 return adoptRef(new ContextFeatures(client)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 inline bool ContextFeatures::isEnabled(Document* document, FeatureType type, boo
l defaultValue) const | 96 inline bool ContextFeatures::isEnabled(Document* document, FeatureType type, boo
l defaultValue) const |
| 97 { | 97 { |
| 98 if (!m_client) | 98 if (!m_client) |
| 99 return defaultValue; | 99 return defaultValue; |
| 100 return m_client->isEnabled(document, type, defaultValue); | 100 return m_client->isEnabled(document, type, defaultValue); |
| 101 } | 101 } |
| 102 | 102 |
| 103 inline void ContextFeatures::urlDidChange(Document* document) | 103 inline void ContextFeatures::urlDidChange(Document* document) |
| 104 { | 104 { |
| 105 // FIXME: The original code, commented out below, is obviously | 105 // FIXME: The original code, commented out below, is obviously |
| 106 // wrong, but the seemingly correct fix of negating the test to | 106 // wrong, but the seemingly correct fix of negating the test to |
| 107 // the more logical 'if (!m_client)' crashes the renderer. | 107 // the more logical 'if (!m_client)' crashes the renderer. |
| 108 // See issue 294180 | 108 // See issue 294180 |
| 109 // | 109 // |
| 110 // if (m_client) | 110 // if (m_client) |
| 111 // return; | 111 // return; |
| 112 // m_client->urlDidChange(document); | 112 // m_client->urlDidChange(document); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace WebCore | 115 } // namespace WebCore |
| 116 | 116 |
| 117 #endif // ContextFeatures_h | 117 #endif // ContextFeatures_h |
| OLD | NEW |