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

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: DictionaryValue* to linked_ptr<DictionaryValue> 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 out->tabs.reset(new std::vector<linked_ptr<tabs::Tab> >);
32 json_schema_compiler::util::GetOptionalArrayFromDictionary(*dict, "tabs", &out ->tabs);
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 json_schema_compiler::util::SetOptionalArrayFromDictionary(tabs, "tabs", value );
58 value->SetWithoutPathExpansion("top", Value::CreateIntegerValue(top));
59 value->SetWithoutPathExpansion("height", Value::CreateIntegerValue(height));
60 value->SetWithoutPathExpansion("width", Value::CreateIntegerValue(width));
61 value->SetWithoutPathExpansion("state", Value::CreateStringValue(state));
62 value->SetWithoutPathExpansion("focused", Value::CreateBooleanValue(focused));
63 value->SetWithoutPathExpansion("left", Value::CreateIntegerValue(left));
64 value->SetWithoutPathExpansion("type", Value::CreateStringValue(type));
65 value->SetWithoutPathExpansion("id", Value::CreateIntegerValue(id));
66 value->SetWithoutPathExpansion("incognito", Value::CreateBooleanValue(incognit o));
67
68 return value;
69 }
70
71
72 //
73 // Functions
74 //
75
76 Get::Params::GetInfo::GetInfo() {}
77 Get::Params::GetInfo::~GetInfo() {}
78
79 // static
80 bool Get::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
81 if (!value.IsType(Value::TYPE_DICTIONARY))
82 return false;
83 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
84
85 out->populate.reset(new bool);
86 dict->GetBoolean("populate", out->populate.get());
87 return true;
88 }
89
90
91
92 Get::Params::Params() {}
93 Get::Params::~Params() {}
94
95 // static
96 scoped_ptr<Get::Params> Get::Params::Create(const ListValue& args) {
97
98 scoped_ptr<Params> params(new Params());
99
100 if(!args.GetInteger(0, &params->window_id))
101 return scoped_ptr<Params>();
102
103 DictionaryValue* get_info_param = NULL;
104 if (!args.GetDictionary(1, &get_info_param))
105 return params.Pass();
106 params->get_info.reset(new GetInfo());
107 if(!GetInfo::Populate(*get_info_param, params->get_info.get()))
108 return params.Pass();
109
110 return params.Pass();
111 }
112
113 // static
114 Value* Get::Result::Create(const Window& window) {
115 return window.ToValue();
116 }
117
118 GetCurrent::Params::GetInfo::GetInfo() {}
119 GetCurrent::Params::GetInfo::~GetInfo() {}
120
121 // static
122 bool GetCurrent::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
123 if (!value.IsType(Value::TYPE_DICTIONARY))
124 return false;
125 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
126
127 out->populate.reset(new bool);
128 dict->GetBoolean("populate", out->populate.get());
129 return true;
130 }
131
132
133
134 GetCurrent::Params::Params() {}
135 GetCurrent::Params::~Params() {}
136
137 // static
138 scoped_ptr<GetCurrent::Params> GetCurrent::Params::Create(const ListValue& args) {
139
140 scoped_ptr<Params> params(new Params());
141
142 DictionaryValue* get_info_param = NULL;
143 if (!args.GetDictionary(0, &get_info_param))
144 return params.Pass();
145 params->get_info.reset(new GetInfo());
146 if(!GetInfo::Populate(*get_info_param, params->get_info.get()))
147 return params.Pass();
148
149 return params.Pass();
150 }
151
152 // static
153 Value* GetCurrent::Result::Create(const Window& window) {
154 return window.ToValue();
155 }
156
157 Create::Params::CreateData::CreateData() {}
158 Create::Params::CreateData::~CreateData() {}
159
160 // static
161 bool Create::Params::CreateData::Populate(const Value& value, CreateData* out) {
162 if (!value.IsType(Value::TYPE_DICTIONARY))
163 return false;
164 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
165
166 out->tab_id.reset(new int);
167 dict->GetInteger("tabId", out->tab_id.get());
168 if(!json_schema_compiler::util::GetArrayFromDictionary(*dict, "createData", &o ut->create_data_array))
169 return false;
170 out->top.reset(new int);
171 dict->GetInteger("top", out->top.get());
172 out->height.reset(new int);
173 dict->GetInteger("height", out->height.get());
174 out->width.reset(new int);
175 dict->GetInteger("width", out->width.get());
176 out->focused.reset(new bool);
177 dict->GetBoolean("focused", out->focused.get());
178 out->left.reset(new int);
179 dict->GetInteger("left", out->left.get());
180 out->type.reset(new std::string);
181 dict->GetString("type", out->type.get());
182 out->incognito.reset(new bool);
183 dict->GetBoolean("incognito", out->incognito.get());
184 return true;
185 }
186
187
188
189 Create::Params::Params() {}
190 Create::Params::~Params() {}
191
192 // static
193 scoped_ptr<Create::Params> Create::Params::Create(const ListValue& args) {
194
195 scoped_ptr<Params> params(new Params());
196
197 DictionaryValue* create_data_param = NULL;
198 if (!args.GetDictionary(0, &create_data_param))
199 return params.Pass();
200 params->create_data.reset(new CreateData());
201 if(!CreateData::Populate(*create_data_param, params->create_data.get()))
202 return params.Pass();
203
204 return params.Pass();
205 }
206
207 // static
208 // Contains details about the created window.
209 Value* Create::Result::Create(const Window& window) {
210 return window.ToValue();
211 }
212
213 GetAll::Params::GetInfo::GetInfo() {}
214 GetAll::Params::GetInfo::~GetInfo() {}
215
216 // static
217 bool GetAll::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
218 if (!value.IsType(Value::TYPE_DICTIONARY))
219 return false;
220 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
221
222 out->populate.reset(new bool);
223 dict->GetBoolean("populate", out->populate.get());
224 return true;
225 }
226
227
228
229 GetAll::Params::Params() {}
230 GetAll::Params::~Params() {}
231
232 // static
233 scoped_ptr<GetAll::Params> GetAll::Params::Create(const ListValue& args) {
234
235 scoped_ptr<Params> params(new Params());
236
237 DictionaryValue* get_info_param = NULL;
238 if (!args.GetDictionary(0, &get_info_param))
239 return params.Pass();
240 params->get_info.reset(new GetInfo());
241 if(!GetInfo::Populate(*get_info_param, params->get_info.get()))
242 return params.Pass();
243
244 return params.Pass();
245 }
246
247 // static
248 Value* GetAll::Result::Create(const std::vector<linked_ptr<Window> > windows) {
249 ListValue* l = new ListValue();
250 for (std::vector<linked_ptr<Window> >::const_iterator it = windows.begin(); it != windows.end(); ++it) {
251 l->Append((**it).ToValue());
252 }
253 return l;
254 }
255
256 Update::Params::UpdateInfo::UpdateInfo() {}
257 Update::Params::UpdateInfo::~UpdateInfo() {}
258
259 // static
260 bool Update::Params::UpdateInfo::Populate(const Value& value, UpdateInfo* out) {
261 if (!value.IsType(Value::TYPE_DICTIONARY))
262 return false;
263 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
264
265 out->top.reset(new int);
266 dict->GetInteger("top", out->top.get());
267 out->draw_attention.reset(new bool);
268 dict->GetBoolean("drawAttention", out->draw_attention.get());
269 out->height.reset(new int);
270 dict->GetInteger("height", out->height.get());
271 out->width.reset(new int);
272 dict->GetInteger("width", out->width.get());
273 out->state.reset(new std::string);
274 dict->GetString("state", out->state.get());
275 out->focused.reset(new bool);
276 dict->GetBoolean("focused", out->focused.get());
277 out->left.reset(new int);
278 dict->GetInteger("left", out->left.get());
279 return true;
280 }
281
282
283
284 Update::Params::Params() {}
285 Update::Params::~Params() {}
286
287 // static
288 scoped_ptr<Update::Params> Update::Params::Create(const ListValue& args) {
289
290 scoped_ptr<Params> params(new Params());
291
292 if(!args.GetInteger(0, &params->window_id))
293 return scoped_ptr<Params>();
294
295 DictionaryValue* update_info_param = NULL;
296 if (!args.GetDictionary(1, &update_info_param))
297 return scoped_ptr<Params>();
298 if(!UpdateInfo::Populate(*update_info_param, &params->update_info))
299 return scoped_ptr<Params>();
300
301 return params.Pass();
302 }
303
304 // static
305 Value* Update::Result::Create(const Window& window) {
306 return window.ToValue();
307 }
308
309 Remove::Params::Params() {}
310 Remove::Params::~Params() {}
311
312 // static
313 scoped_ptr<Remove::Params> Remove::Params::Create(const ListValue& args) {
314
315 scoped_ptr<Params> params(new Params());
316
317 if(!args.GetInteger(0, &params->window_id))
318 return scoped_ptr<Params>();
319
320 return params.Pass();
321 }
322
323 // static
324 Value* Remove::Result::Create() {
325 return Value::CreateNullValue();
326 }
327
328 GetLastFocused::Params::GetInfo::GetInfo() {}
329 GetLastFocused::Params::GetInfo::~GetInfo() {}
330
331 // static
332 bool GetLastFocused::Params::GetInfo::Populate(const Value& value, GetInfo* out) {
333 if (!value.IsType(Value::TYPE_DICTIONARY))
334 return false;
335 const DictionaryValue* dict = static_cast<const DictionaryValue*>(&value);
336
337 out->populate.reset(new bool);
338 dict->GetBoolean("populate", out->populate.get());
339 return true;
340 }
341
342
343
344 GetLastFocused::Params::Params() {}
345 GetLastFocused::Params::~Params() {}
346
347 // static
348 scoped_ptr<GetLastFocused::Params> GetLastFocused::Params::Create(const ListValu e& args) {
349
350 scoped_ptr<Params> params(new Params());
351
352 DictionaryValue* get_info_param = NULL;
353 if (!args.GetDictionary(0, &get_info_param))
354 return params.Pass();
355 params->get_info.reset(new GetInfo());
356 if(!GetInfo::Populate(*get_info_param, params->get_info.get()))
357 return params.Pass();
358
359 return params.Pass();
360 }
361
362 // static
363 Value* GetLastFocused::Result::Create(const Window& window) {
364 return window.ToValue();
365 }
366
367 } // windows
368 } // api
369 } // extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698