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

Side by Side Diff: headless/lib/browser/domain_h.template

Issue 2476723002: headless: Register event handlers on demand (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « headless/lib/browser/domain_cc.template ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file is generated 1 // This file is generated
2 2
3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 3 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be 4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file. 5 // found in the LICENSE file.
6 6
7 #ifndef HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | up per}}_H_ 7 #ifndef HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | up per}}_H_
8 #define HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | up per}}_H_ 8 #define HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | up per}}_H_
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 {# Generate event dispatchers. #} 113 {# Generate event dispatchers. #}
114 {% for event in domain.events %} 114 {% for event in domain.events %}
115 void Dispatch{{event.name | to_title_case}}Event(const base::Value& params); 115 void Dispatch{{event.name | to_title_case}}Event(const base::Value& params);
116 {% endfor %} 116 {% endfor %}
117 117
118 internal::MessageDispatcher* dispatcher_; // Not owned. 118 internal::MessageDispatcher* dispatcher_; // Not owned.
119 {% if "events" in domain %} 119 {% if "events" in domain %}
120 base::ObserverList<ExperimentalObserver> observers_; 120 base::ObserverList<ExperimentalObserver> observers_;
121 {% endif %} 121 {% endif %}
122 122
123 {% if "events" in domain %}
124 protected:
125 void RegisterEventHandlersIfNeeded();
126
127 {% endif %}
123 private: 128 private:
129 {% if "events" in domain %}
130 bool event_handlers_registered_ = false;
131
132 {% endif %}
124 DISALLOW_COPY_AND_ASSIGN(Domain); 133 DISALLOW_COPY_AND_ASSIGN(Domain);
125 }; 134 };
126 135
127 class ExperimentalDomain : public Domain { 136 class ExperimentalDomain : public Domain {
128 public: 137 public:
129 ExperimentalDomain(internal::MessageDispatcher* dispatcher); 138 ExperimentalDomain(internal::MessageDispatcher* dispatcher);
130 ~ExperimentalDomain(); 139 ~ExperimentalDomain();
131 140
132 {% if "events" in domain %} 141 {% if "events" in domain %}
133 // Add or remove an observer. |observer| must be removed before being 142 // Add or remove an observer. |observer| must be removed before being
(...skipping 12 matching lines...) Expand all
146 {% endfor %} 155 {% endfor %}
147 156
148 private: 157 private:
149 DISALLOW_COPY_AND_ASSIGN(ExperimentalDomain); 158 DISALLOW_COPY_AND_ASSIGN(ExperimentalDomain);
150 }; 159 };
151 160
152 } // namespace {{domain.domain | camelcase_to_hacker_style}} 161 } // namespace {{domain.domain | camelcase_to_hacker_style}}
153 } // namespace headless 162 } // namespace headless
154 163
155 #endif // HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | upper}}_H_ 164 #endif // HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | upper}}_H_
OLDNEW
« no previous file with comments | « headless/lib/browser/domain_cc.template ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698