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

Side by Side Diff: headless/lib/browser/devtools_api/domain_cc.template

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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 // This file is generated 1 // This file is generated
2 2
3 // Copyright 2016 The Chromium Authors. All rights reserved. 3 // Copyright 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 #include "headless/public/devtools/domains/{{domain.domain | camelcase_to_hacker _style}}.h" 7 #include "headless/public/devtools/domains/{{domain.domain | camelcase_to_hacker _style}}.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 {# Generate response handlers for commands that need them. #} 96 {# Generate response handlers for commands that need them. #}
97 {% for command in domain.commands %} 97 {% for command in domain.commands %}
98 {% if not "returns" in command %}{% continue %}{% endif %} 98 {% if not "returns" in command %}{% continue %}{% endif %}
99 {% set method_name = command.name | to_title_case %} 99 {% set method_name = command.name | to_title_case %}
100 100
101 // static 101 // static
102 void Domain::Handle{{method_name}}Response(base::Callback<void(std::unique_ptr<{ {method_name}}Result>)> callback, const base::Value& response) { 102 void Domain::Handle{{method_name}}Response(base::Callback<void(std::unique_ptr<{ {method_name}}Result>)> callback, const base::Value& response) {
103 if (callback.is_null()) 103 if (callback.is_null())
104 return; 104 return;
105 // This is an error response. 105 // This is an error response.
106 if (response.IsType(base::Value::TYPE_NULL)) { 106 if (response.IsType(base::Value::Type::NONE)) {
107 callback.Run(nullptr); 107 callback.Run(nullptr);
108 return; 108 return;
109 } 109 }
110 ErrorReporter errors; 110 ErrorReporter errors;
111 std::unique_ptr<{{method_name}}Result> result = {{method_name}}Result::Parse(r esponse, &errors); 111 std::unique_ptr<{{method_name}}Result> result = {{method_name}}Result::Parse(r esponse, &errors);
112 DCHECK(!errors.HasErrors()); 112 DCHECK(!errors.HasErrors());
113 callback.Run(std::move(result)); 113 callback.Run(std::move(result));
114 } 114 }
115 {% endfor %} 115 {% endfor %}
116 {% if "events" in domain %} 116 {% if "events" in domain %}
(...skipping 29 matching lines...) Expand all
146 } 146 }
147 147
148 void ExperimentalDomain::RemoveObserver(ExperimentalObserver* observer) { 148 void ExperimentalDomain::RemoveObserver(ExperimentalObserver* observer) {
149 observers_.RemoveObserver(observer); 149 observers_.RemoveObserver(observer);
150 } 150 }
151 {% endif %} 151 {% endif %}
152 152
153 } // namespace {{domain.domain | camelcase_to_hacker_style}} 153 } // namespace {{domain.domain | camelcase_to_hacker_style}}
154 154
155 } // namespace headless 155 } // namespace headless
OLDNEW
« no previous file with comments | « gpu/tools/compositor_model_bench/render_tree.cc ('k') | headless/public/domains/types_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698