Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 19 matching lines...) Expand all Loading... | |
| 30 | 30 |
| 31 #ifndef CustomElementCallback_h | 31 #ifndef CustomElementCallback_h |
| 32 #define CustomElementCallback_h | 32 #define CustomElementCallback_h |
| 33 | 33 |
| 34 #include "wtf/RefCounted.h" | 34 #include "wtf/RefCounted.h" |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| 37 | 37 |
| 38 class Element; | 38 class Element; |
| 39 | 39 |
| 40 class CustomElementCallback : public RefCounted<CustomElementCallback> { | 40 class CustomElementCallback : public RefCounted<CustomElementCallback> { |
|
dglazkov
2013/06/25 18:04:31
I wonder if these should be named CustomElementLif
| |
| 41 public: | 41 public: |
| 42 virtual ~CustomElementCallback() { } | 42 virtual ~CustomElementCallback() { } |
| 43 | 43 |
| 44 bool hasReady() const { return m_which == Ready; } | 44 bool hasReady() const { return m_which & Ready; } |
| 45 virtual void ready(Element*) = 0; | 45 virtual void ready(Element*) = 0; |
| 46 | 46 |
| 47 protected: | 47 bool hasInserted() const { return m_which & Inserted; } |
| 48 virtual void inserted(Element*) = 0; | |
| 49 | |
| 50 bool hasRemoved() const { return m_which & Removed; } | |
| 51 virtual void removed(Element*) = 0; | |
| 52 | |
| 48 enum CallbackType { | 53 enum CallbackType { |
| 49 None, | 54 None = 0, |
| 50 Ready | 55 Ready = 1 << 0, |
| 56 Inserted = 1 << 1, | |
| 57 Removed = 1 << 2 | |
| 51 }; | 58 }; |
| 52 | 59 |
| 60 protected: | |
| 53 CustomElementCallback(CallbackType which) : m_which(which) { } | 61 CustomElementCallback(CallbackType which) : m_which(which) { } |
| 54 | 62 |
| 55 private: | 63 private: |
| 56 CallbackType m_which; | 64 CallbackType m_which; |
| 57 }; | 65 }; |
| 58 | 66 |
| 59 } | 67 } |
| 60 | 68 |
| 61 #endif // CustomElementCallback_h | 69 #endif // CustomElementCallback_h |
| OLD | NEW |