Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: Source/core/dom/custom/CustomElementCallbackInvocation.cpp

Issue 494133002: Append "Callback" to each value of enum CallbackType (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 private: 44 private:
45 virtual void dispatch(Element*) OVERRIDE; 45 virtual void dispatch(Element*) OVERRIDE;
46 46
47 CustomElementLifecycleCallbacks::CallbackType m_which; 47 CustomElementLifecycleCallbacks::CallbackType m_which;
48 }; 48 };
49 49
50 AttachedDetachedInvocation::AttachedDetachedInvocation(PassRefPtr<CustomElementL ifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType whic h) 50 AttachedDetachedInvocation::AttachedDetachedInvocation(PassRefPtr<CustomElementL ifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType whic h)
51 : CustomElementCallbackInvocation(callbacks) 51 : CustomElementCallbackInvocation(callbacks)
52 , m_which(which) 52 , m_which(which)
53 { 53 {
54 ASSERT(m_which == CustomElementLifecycleCallbacks::Attached || m_which == Cu stomElementLifecycleCallbacks::Detached); 54 ASSERT(m_which == CustomElementLifecycleCallbacks::AttachedCallback || m_whi ch == CustomElementLifecycleCallbacks::DetachedCallback);
55 } 55 }
56 56
57 void AttachedDetachedInvocation::dispatch(Element* element) 57 void AttachedDetachedInvocation::dispatch(Element* element)
58 { 58 {
59 switch (m_which) { 59 switch (m_which) {
60 case CustomElementLifecycleCallbacks::Attached: 60 case CustomElementLifecycleCallbacks::AttachedCallback:
61 callbacks()->attached(element); 61 callbacks()->attached(element);
62 break; 62 break;
63 case CustomElementLifecycleCallbacks::Detached: 63 case CustomElementLifecycleCallbacks::DetachedCallback:
64 callbacks()->detached(element); 64 callbacks()->detached(element);
65 break; 65 break;
66 default: 66 default:
67 ASSERT_NOT_REACHED(); 67 ASSERT_NOT_REACHED();
68 } 68 }
69 } 69 }
70 70
71 class AttributeChangedInvocation : public CustomElementCallbackInvocation { 71 class AttributeChangedInvocation : public CustomElementCallbackInvocation {
72 public: 72 public:
73 AttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, cons t AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue ); 73 AttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks>, cons t AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue );
(...skipping 27 matching lines...) Expand all
101 } 101 }
102 102
103 private: 103 private:
104 virtual void dispatch(Element*) OVERRIDE; 104 virtual void dispatch(Element*) OVERRIDE;
105 virtual bool isCreated() const OVERRIDE { return true; } 105 virtual bool isCreated() const OVERRIDE { return true; }
106 }; 106 };
107 107
108 void CreatedInvocation::dispatch(Element* element) 108 void CreatedInvocation::dispatch(Element* element)
109 { 109 {
110 if (element->inDocument() && element->document().domWindow()) 110 if (element->inDocument() && element->document().domWindow())
111 CustomElementScheduler::scheduleCallback(callbacks(), element, CustomEle mentLifecycleCallbacks::Attached); 111 CustomElementScheduler::scheduleCallback(callbacks(), element, CustomEle mentLifecycleCallbacks::AttachedCallback);
112 callbacks()->created(element); 112 callbacks()->created(element);
113 } 113 }
114 114
115 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre ateInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomEleme ntLifecycleCallbacks::CallbackType which) 115 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre ateInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomEleme ntLifecycleCallbacks::CallbackType which)
116 { 116 {
117 switch (which) { 117 switch (which) {
118 case CustomElementLifecycleCallbacks::Created: 118 case CustomElementLifecycleCallbacks::CreatedCallback:
119 return adoptPtr(new CreatedInvocation(callbacks)); 119 return adoptPtr(new CreatedInvocation(callbacks));
120 120
121 case CustomElementLifecycleCallbacks::Attached: 121 case CustomElementLifecycleCallbacks::AttachedCallback:
122 case CustomElementLifecycleCallbacks::Detached: 122 case CustomElementLifecycleCallbacks::DetachedCallback:
123 return adoptPtr(new AttachedDetachedInvocation(callbacks, which)); 123 return adoptPtr(new AttachedDetachedInvocation(callbacks, which));
124 default: 124 default:
125 ASSERT_NOT_REACHED(); 125 ASSERT_NOT_REACHED();
126 return PassOwnPtr<CustomElementCallbackInvocation>(); 126 return PassOwnPtr<CustomElementCallbackInvocation>();
127 } 127 }
128 } 128 }
129 129
130 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre ateAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callba cks, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) 130 PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::cre ateAttributeChangedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callba cks, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
131 { 131 {
132 return adoptPtr(new AttributeChangedInvocation(callbacks, name, oldValue, ne wValue)); 132 return adoptPtr(new AttributeChangedInvocation(callbacks, name, oldValue, ne wValue));
133 } 133 }
134 134
135 } // namespace blink 135 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/custom/CustomElement.cpp ('k') | Source/core/dom/custom/CustomElementLifecycleCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698