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

Side by Side Diff: generated_files_will_not_submit/windows.cc

Issue 9309044: Supporting more APIs with json_schema_compiler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: support for choices Created 8 years, 10 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // GENERATED FROM THE API DEFINITION IN
6 // chrome/common/extensions/api/windows.json
7 // DO NOT EDIT.
8
9 #include "tools/json_schema_compiler/util.h"
10 #include "chrome/common/extensions/api/windows.h"
11 #include "chrome/common/extensions/api/tabs.h"
12
13
14 namespace extensions {
15 namespace api {
16 namespace windows {
17
18 //
19 // Types
20 //
21
22 Window::Window() {}
23 Window::~Window() {}
24
25 // static
26 bool Window::Populate(const Value& value, Window* out) {
27 if (!value.IsType(Value::TYPE_DICTIONARY))
28 return false;
29 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
30
31 if (!json_schema_compiler::util::GetOptionalArrayFromDictionary(*dict, "tabs", &out->tabs))
32 return false;
33 if (!dict->GetInteger("top", &out->top))
34 return false;
35 if (!dict->GetInteger("height", &out->height))
36 return false;
37 if (!dict->GetInteger("width", &out->width))
38 return false;
39 if (!dict->GetString("state", &out->state))
40 return false;
41 if (!dict->GetBoolean("focused", &out->focused))
42 return false;
43 if (!dict->GetInteger("left", &out->left))
44 return false;
45 if (!dict->GetString("type", &out->type))
46 return false;
47 if (!dict->GetInteger("id", &out->id))
48 return false;
49 if (!dict->GetBoolean("incognito", &out->incognito))
50 return false;
51 return true;
52 }
53
54 DictionaryValue* Window::ToValue() const {
55 DictionaryValue* value = new DictionaryValue();
56
57 if (tabs.get())
58 json_schema_compiler::util::SetOptionalArrayToDictionary(tabs, "tabs", value );
59 value->SetWithoutPathExpansion("top", Value::CreateIntegerValue(top));
60 value->SetWithoutPathExpansion("height", Value::CreateIntegerValue(height));
61 value->SetWithoutPathExpansion("width", Value::CreateIntegerValue(width));
62 value->SetWithoutPathExpansion("state", Value::CreateStringValue(state));
63 value->SetWithoutPathExpansion("focused", Value::CreateBooleanValue(focused));
64 value->SetWithoutPathExpansion("left", Value::CreateIntegerValue(left));
65 value->SetWithoutPathExpansion("type", Value::CreateStringValue(type));
66 value->SetWithoutPathExpansion("id", Value::CreateIntegerValue(id));
67 value->SetWithoutPathExpansion("incognito", Value::CreateBooleanValue(incognit o));
68
69 return value;
70 }
71
72
73 //
74 // Functions
75 //
76
77 Get::Params::GetInfo::GetInfo() {}
78 Get::Params::GetInfo::~GetInfo() {}
79
80 // static
81 bool Get::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
82 if (!value.IsType(Value::TYPE_DICTIONARY))
83 return false;
84 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
85
86 {
87 bool populate_temp;
88 if (dict->GetBoolean("populate", &populate_temp))
89 out->populate.reset(new bool(populate_temp));
90 }
91 return true;
92 }
93
94
95
96 Get::Params::Params() {}
97 Get::Params::~Params() {}
98
99 // static
100 scoped_ptr<Get::Params> Get::Params::Create(const ListValue& args) {
101 if (args.GetSize() > 2)
102 return scoped_ptr<Params>();
103 if (args.GetSize() < 1)
104 return scoped_ptr<Params>();
105 scoped_ptr<Params> params(new Params());
106
107 if (!args.GetInteger(0, &params->window_id))
108 return scoped_ptr<Params>();
109
110 DictionaryValue* get_info_param = NULL;
111 if (!args.GetDictionary(1, &get_info_param))
112 return params.Pass();
113 params->get_info.reset(new GetInfo());
114 if (!GetInfo::Populate(*get_info_param, params->get_info.get()))
115 return params.Pass();
116
117 return params.Pass();
118 }
119
120 // static
121 Value* Get::Result::Create(const Window& window) {
122 return window.ToValue();
123 }
124
125 GetCurrent::Params::GetInfo::GetInfo() {}
126 GetCurrent::Params::GetInfo::~GetInfo() {}
127
128 // static
129 bool GetCurrent::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
130 if (!value.IsType(Value::TYPE_DICTIONARY))
131 return false;
132 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
133
134 {
135 bool populate_temp;
136 if (dict->GetBoolean("populate", &populate_temp))
137 out->populate.reset(new bool(populate_temp));
138 }
139 return true;
140 }
141
142
143
144 GetCurrent::Params::Params() {}
145 GetCurrent::Params::~Params() {}
146
147 // static
148 scoped_ptr<GetCurrent::Params> GetCurrent::Params::Create(const ListValue& args) {
149 if (args.GetSize() > 1)
150 return scoped_ptr<Params>();
151 scoped_ptr<Params> params(new Params());
152
153 DictionaryValue* get_info_param = NULL;
154 if (!args.GetDictionary(0, &get_info_param))
155 return params.Pass();
156 params->get_info.reset(new GetInfo());
157 if (!GetInfo::Populate(*get_info_param, params->get_info.get()))
158 return params.Pass();
159
160 return params.Pass();
161 }
162
163 // static
164 Value* GetCurrent::Result::Create(const Window& window) {
165 return window.ToValue();
166 }
167
168 Create::Params::CreateData::CreateData() {}
169 Create::Params::CreateData::~CreateData() {}
170
171 // static
172 bool Create::Params::CreateData::Populate(const Value& value, CreateData* out) {
173 if (!value.IsType(Value::TYPE_DICTIONARY))
174 return false;
175 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
176
177 {
178 int tab_id_temp;
179 if (dict->GetInteger("tabId", &tab_id_temp))
180 out->tab_id.reset(new int(tab_id_temp));
181 }
182 {
183 std::string url_temp;
184 if (dict->GetString("url", &url_temp))
185 out->url.reset(new std::string(url_temp));
186 }
187 {
188 int top_temp;
189 if (dict->GetInteger("top", &top_temp))
190 out->top.reset(new int(top_temp));
191 }
192 {
193 int height_temp;
194 if (dict->GetInteger("height", &height_temp))
195 out->height.reset(new int(height_temp));
196 }
197 {
198 int width_temp;
199 if (dict->GetInteger("width", &width_temp))
200 out->width.reset(new int(width_temp));
201 }
202 {
203 bool focused_temp;
204 if (dict->GetBoolean("focused", &focused_temp))
205 out->focused.reset(new bool(focused_temp));
206 }
207 {
208 int left_temp;
209 if (dict->GetInteger("left", &left_temp))
210 out->left.reset(new int(left_temp));
211 }
212 {
213 std::string type_temp;
214 if (dict->GetString("type", &type_temp))
215 out->type.reset(new std::string(type_temp));
216 }
217 {
218 bool incognito_temp;
219 if (dict->GetBoolean("incognito", &incognito_temp))
220 out->incognito.reset(new bool(incognito_temp));
221 }
222 return true;
223 }
224
225
226
227 Create::Params::Params() {}
228 Create::Params::~Params() {}
229
230 // static
231 scoped_ptr<Create::Params> Create::Params::Create(const ListValue& args) {
232 if (args.GetSize() > 1)
233 return scoped_ptr<Params>();
234 scoped_ptr<Params> params(new Params());
235
236 DictionaryValue* create_data_param = NULL;
237 if (!args.GetDictionary(0, &create_data_param))
238 return params.Pass();
239 params->create_data.reset(new CreateData());
240 if (!CreateData::Populate(*create_data_param, params->create_data.get()))
241 return params.Pass();
242
243 return params.Pass();
244 }
245
246 // static
247 // Contains details about the created window.
248 Value* Create::Result::Create(const scoped_ptr<Window>& window) {
249 return window->ToValue();
250 }
251
252 GetAll::Params::GetInfo::GetInfo() {}
253 GetAll::Params::GetInfo::~GetInfo() {}
254
255 // static
256 bool GetAll::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
257 if (!value.IsType(Value::TYPE_DICTIONARY))
258 return false;
259 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
260
261 {
262 bool populate_temp;
263 if (dict->GetBoolean("populate", &populate_temp))
264 out->populate.reset(new bool(populate_temp));
265 }
266 return true;
267 }
268
269
270
271 GetAll::Params::Params() {}
272 GetAll::Params::~Params() {}
273
274 // static
275 scoped_ptr<GetAll::Params> GetAll::Params::Create(const ListValue& args) {
276 if (args.GetSize() > 1)
277 return scoped_ptr<Params>();
278 scoped_ptr<Params> params(new Params());
279
280 DictionaryValue* get_info_param = NULL;
281 if (!args.GetDictionary(0, &get_info_param))
282 return params.Pass();
283 params->get_info.reset(new GetInfo());
284 if (!GetInfo::Populate(*get_info_param, params->get_info.get()))
285 return params.Pass();
286
287 return params.Pass();
288 }
289
290 // static
291 Value* GetAll::Result::Create(const std::vector<linked_ptr<Window> > windows) {
292 ListValue* value = new ListValue();
293 json_schema_compiler::util::SetArrayToList(windows, value);
294 return value;
295 }
296
297 Update::Params::UpdateInfo::UpdateInfo() {}
298 Update::Params::UpdateInfo::~UpdateInfo() {}
299
300 // static
301 bool Update::Params::UpdateInfo::Populate(const Value& value, UpdateInfo* out) {
302 if (!value.IsType(Value::TYPE_DICTIONARY))
303 return false;
304 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
305
306 {
307 int top_temp;
308 if (dict->GetInteger("top", &top_temp))
309 out->top.reset(new int(top_temp));
310 }
311 {
312 bool draw_attention_temp;
313 if (dict->GetBoolean("drawAttention", &draw_attention_temp))
314 out->draw_attention.reset(new bool(draw_attention_temp));
315 }
316 {
317 int height_temp;
318 if (dict->GetInteger("height", &height_temp))
319 out->height.reset(new int(height_temp));
320 }
321 {
322 int width_temp;
323 if (dict->GetInteger("width", &width_temp))
324 out->width.reset(new int(width_temp));
325 }
326 {
327 std::string state_temp;
328 if (dict->GetString("state", &state_temp))
329 out->state.reset(new std::string(state_temp));
330 }
331 {
332 bool focused_temp;
333 if (dict->GetBoolean("focused", &focused_temp))
334 out->focused.reset(new bool(focused_temp));
335 }
336 {
337 int left_temp;
338 if (dict->GetInteger("left", &left_temp))
339 out->left.reset(new int(left_temp));
340 }
341 return true;
342 }
343
344
345
346 Update::Params::Params() {}
347 Update::Params::~Params() {}
348
349 // static
350 scoped_ptr<Update::Params> Update::Params::Create(const ListValue& args) {
351 if (args.GetSize() < 2)
352 return scoped_ptr<Params>();
353 scoped_ptr<Params> params(new Params());
354
355 if (!args.GetInteger(0, &params->window_id))
356 return scoped_ptr<Params>();
357
358 DictionaryValue* update_info_param = NULL;
359 if (!args.GetDictionary(1, &update_info_param))
360 return scoped_ptr<Params>();
361 if (!UpdateInfo::Populate(*update_info_param, &params->update_info))
362 return scoped_ptr<Params>();
363
364 return params.Pass();
365 }
366
367 // static
368 Value* Update::Result::Create(const Window& window) {
369 return window.ToValue();
370 }
371
372 Remove::Params::Params() {}
373 Remove::Params::~Params() {}
374
375 // static
376 scoped_ptr<Remove::Params> Remove::Params::Create(const ListValue& args) {
377 if (args.GetSize() < 1)
378 return scoped_ptr<Params>();
379 scoped_ptr<Params> params(new Params());
380
381 if (!args.GetInteger(0, &params->window_id))
382 return scoped_ptr<Params>();
383
384 return params.Pass();
385 }
386
387 // static
388 Value* Remove::Result::Create() {
389 return Value::CreateNullValue();
390 }
391
392 GetLastFocused::Params::GetInfo::GetInfo() {}
393 GetLastFocused::Params::GetInfo::~GetInfo() {}
394
395 // static
396 bool GetLastFocused::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
397 if (!value.IsType(Value::TYPE_DICTIONARY))
398 return false;
399 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
400
401 {
402 bool populate_temp;
403 if (dict->GetBoolean("populate", &populate_temp))
404 out->populate.reset(new bool(populate_temp));
405 }
406 return true;
407 }
408
409
410
411 GetLastFocused::Params::Params() {}
412 GetLastFocused::Params::~Params() {}
413
414 // static
415 scoped_ptr<GetLastFocused::Params> GetLastFocused::Params::Create(const ListValu e& args) {
416 if (args.GetSize() > 1)
417 return scoped_ptr<Params>();
418 scoped_ptr<Params> params(new Params());
419
420 DictionaryValue* get_info_param = NULL;
421 if (!args.GetDictionary(0, &get_info_param))
422 return params.Pass();
423 params->get_info.reset(new GetInfo());
424 if (!GetInfo::Populate(*get_info_param, params->get_info.get()))
425 return params.Pass();
426
427 return params.Pass();
428 }
429
430 // static
431 Value* GetLastFocused::Result::Create(const Window& window) {
432 return window.ToValue();
433 }
434
435 } // windows
436 } // api
437 } // extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698