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

Side by Side Diff: generated_files_will_not_submit/tabs.h

Issue 9309044: Supporting more APIs with json_schema_compiler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rework 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/tabs.json
7 // DO NOT EDIT.
8
9 #ifndef CHROME_COMMON_EXTENSIONS_API_TABS_H__
10 #define CHROME_COMMON_EXTENSIONS_API_TABS_H__
11 #pragma once
12
13 #include <string>
14 #include <vector>
15
16 #include "base/basictypes.h"
17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/scoped_ptr.h"
19 #include "base/values.h"
20
21 using base::Value;
22 using base::DictionaryValue;
23 using base::ListValue;
24
25 namespace extensions {
26 namespace api {
27 namespace tabs {
28
29 //
30 // Types
31 //
32
33 struct Tab {
34 ~Tab();
35 Tab();
36
37 // Either <em>loading</em> or <em>complete</em>.
38 scoped_ptr<std::string> status;
39
40 // The zero-based index of the tab within its window.
41 int index;
42
43 // The ID of the tab that opened this tab, if any. This will only be present
44 // if the opener tab still exists.
45 scoped_ptr<int> opener_tab_id;
46
47 // Whether the tab is pinned.
48 bool pinned;
49
50 // The title of the tab. This may not be available if the tab is loading.
51 scoped_ptr<std::string> title;
52
53 // The URL the tab is displaying.
54 std::string url;
55
56 // Whether the tab is selected.
57 bool selected;
58
59 // Whether the tab is highlighted.
60 bool highlighted;
61
62 // The ID of the window the tab is contained within.
63 int window_id;
64
65 // Whether the tab is active in its window.
66 bool active;
67
68 // The URL of the tab's favicon. This may not be available if the tab is
69 // loading.
70 scoped_ptr<std::string> fav_icon_url;
71
72 // The ID of the tab. Tab IDs are unique within a browser session.
73 int id;
74
75 // Whether the tab is in an incognito window.
76 bool incognito;
77
78 // Populates a Tab object from a Value. Returns whether |out| was
79 // successfully populated.
80 static bool Populate(const Value& value, Tab* out);
81
82 // Returns a new DictionaryValue representing the serialized form of this
83 // Tab object. Passesownership to caller.
84 DictionaryValue* ToValue() const;
85
86 private:
87 DISALLOW_COPY_AND_ASSIGN(Tab);
88 };
89
90 //
91 // Functions
92 //
93
94 namespace ExecuteScript {
95 struct Params {
96 // The ID of the tab in which to run the script; defaults to the active tab
97 // of the current window.
98 // Details of the script to run. Either the code or the file property must b e
99 // set, but both may not be set at the same time.
100 // Details of the script to run. Either the code or the file property must b e
101 // set, but both may not be set at the same time.
102 struct Details {
103 ~Details();
104 Details();
105
106 // If allFrames is true, this function injects script into all frames of
107 // current page. By default, it's false and script is injected only into t he
108 // top main frame.
109 scoped_ptr<bool> all_frames;
110
111 // JavaScript code to execute.
112 scoped_ptr<std::string> code;
113
114 // JavaScript file to execute.
115 scoped_ptr<std::string> file;
116
117 // Populates a Details object from a Value. Returns whether |out| was
118 // successfully populated.
119 static bool Populate(const Value& value, Details* out);
120
121
122 private:
123 DISALLOW_COPY_AND_ASSIGN(Details);
124 };
125
126 scoped_ptr<int> tab_id;
127 Details details;
128
129 ~Params();
130
131 static scoped_ptr<Params> Create(const ListValue& args);
132
133 private:
134 Params();
135
136 DISALLOW_COPY_AND_ASSIGN(Params);
137 };
138
139 class Result {
140 public:
141 static Value* Create();
142
143 private:
144 Result() {};
145 DISALLOW_COPY_AND_ASSIGN(Result);
146 };
147
148 };
149
150 namespace Get {
151 struct Params {
152 int tab_id;
153
154 ~Params();
155
156 static scoped_ptr<Params> Create(const ListValue& args);
157
158 private:
159 Params();
160
161 DISALLOW_COPY_AND_ASSIGN(Params);
162 };
163
164 class Result {
165 public:
166 static Value* Create(const Tab& tab);
167
168 private:
169 Result() {};
170 DISALLOW_COPY_AND_ASSIGN(Result);
171 };
172
173 };
174
175 namespace GetCurrent {
176
177 class Result {
178 public:
179 static Value* Create(const Tab& tab);
180
181 private:
182 Result() {};
183 DISALLOW_COPY_AND_ASSIGN(Result);
184 };
185
186 };
187
188 namespace Create {
189 struct Params {
190 struct CreateProperties {
191 ~CreateProperties();
192 CreateProperties();
193
194 // The position the tab should take in the window. The provided value will be
195 // clamped to between zero and the number of tabs in the window.
196 scoped_ptr<int> index;
197
198 // The ID of the tab that opened this tab. If specified, the opener tab mu st
199 // be in the same window as the newly created tab.
200 scoped_ptr<int> opener_tab_id;
201
202 // The URL to navigate the tab to initially. Fully-qualified URLs must
203 // include a scheme (i.e. 'http://www.google.com', not 'www.google.com').
204 // Relative URLs will be relative to the current page within the extension .
205 // Defaults to the New Tab Page.
206 scoped_ptr<std::string> url;
207
208 // Whether the tab should become the selected tab in the window. Defaults to
209 // <var>true</var>
210 scoped_ptr<bool> selected;
211
212 // Whether the tab should be pinned. Defaults to <var>false</var>
213 scoped_ptr<bool> pinned;
214
215 // The window to create the new tab in. Defaults to the <a
216 // href='windows.html#current-window'>current window</a>.
217 scoped_ptr<int> window_id;
218
219 // Whether the tab should become the active tab in the window. Defaults to
220 // <var>true</var>
221 scoped_ptr<bool> active;
222
223 // Populates a CreateProperties object from a Value. Returns whether |out| was
224 // successfully populated.
225 static bool Populate(const Value& value, CreateProperties* out);
226
227
228 private:
229 DISALLOW_COPY_AND_ASSIGN(CreateProperties);
230 };
231
232 CreateProperties create_properties;
233
234 ~Params();
235
236 static scoped_ptr<Params> Create(const ListValue& args);
237
238 private:
239 Params();
240
241 DISALLOW_COPY_AND_ASSIGN(Params);
242 };
243
244 class Result {
245 public:
246 // Details about the created tab. Will contain the ID of the new tab.
247 static Value* Create(const Tab& tab);
248
249 private:
250 Result() {};
251 DISALLOW_COPY_AND_ASSIGN(Result);
252 };
253
254 };
255
256 namespace Update {
257 struct Params {
258 // Defaults to the selected tab of the <a
259 // href='windows.html#current-window'>current window</a>.
260 struct UpdateProperties {
261 ~UpdateProperties();
262 UpdateProperties();
263
264 // Adds or removes the tab from the current selection.
265 scoped_ptr<bool> highlighted;
266
267 // The ID of the tab that opened this tab. If specified, the opener tab mu st
268 // be in the same window as this tab.
269 scoped_ptr<int> opener_tab_id;
270
271 // A URL to navigate the tab to.
272 scoped_ptr<std::string> url;
273
274 // Whether the tab should be selected.
275 scoped_ptr<bool> selected;
276
277 // Whether the tab should be pinned.
278 scoped_ptr<bool> pinned;
279
280 // Whether the tab should be active.
281 scoped_ptr<bool> active;
282
283 // Populates a UpdateProperties object from a Value. Returns whether |out| was
284 // successfully populated.
285 static bool Populate(const Value& value, UpdateProperties* out);
286
287
288 private:
289 DISALLOW_COPY_AND_ASSIGN(UpdateProperties);
290 };
291
292 scoped_ptr<int> tab_id;
293 UpdateProperties update_properties;
294
295 ~Params();
296
297 static scoped_ptr<Params> Create(const ListValue& args);
298
299 private:
300 Params();
301
302 DISALLOW_COPY_AND_ASSIGN(Params);
303 };
304
305 class Result {
306 public:
307 // Details about the updated tab, or <code>null</code> if the 'tabs'
308 // permission has not been requested.
309 static Value* Create(const Tab& tab);
310
311 private:
312 Result() {};
313 DISALLOW_COPY_AND_ASSIGN(Result);
314 };
315
316 };
317
318 namespace CaptureVisibleTab {
319 struct Params {
320 // The target window. Defaults to the <a
321 // href='windows.html#current-window'>current window</a>.
322 // Set parameters of image capture, such as the format of the resulting
323 // image.
324 // Set parameters of image capture, such as the format of the resulting imag e.
325 struct Options {
326 ~Options();
327 Options();
328
329 // When format is 'jpeg', controls the quality of the resulting image. Th is
330 // value is ignored for PNG images. As quality is decreased, the resultin g
331 // image will have more visual artifacts, and the number of bytes needed t o
332 // store it will decrease.
333 scoped_ptr<int> quality;
334
335 // The format of the resulting image. Default is jpeg.
336 scoped_ptr<std::string> format;
337
338 // Populates a Options object from a Value. Returns whether |out| was
339 // successfully populated.
340 static bool Populate(const Value& value, Options* out);
341
342
343 private:
344 DISALLOW_COPY_AND_ASSIGN(Options);
345 };
346
347 scoped_ptr<int> window_id;
348 scoped_ptr<Options> options;
349
350 ~Params();
351
352 static scoped_ptr<Params> Create(const ListValue& args);
353
354 private:
355 Params();
356
357 DISALLOW_COPY_AND_ASSIGN(Params);
358 };
359
360 class Result {
361 public:
362 // A data URL which encodes an image of the visible area of the captured tab .
363 // May be assigned to the 'src' property of an HTML Image element for
364 // display.
365 static Value* Create(const std::string data_url);
366
367 private:
368 Result() {};
369 DISALLOW_COPY_AND_ASSIGN(Result);
370 };
371
372 };
373
374 namespace Reload {
375 struct Params {
376 // The ID of the tab to reload; defaults to the selected tab of the current
377 // window.
378 struct ReloadProperties {
379 ~ReloadProperties();
380 ReloadProperties();
381
382 // Whether using any local cache. Default is false.
383 scoped_ptr<bool> bypass_cache;
384
385 // Populates a ReloadProperties object from a Value. Returns whether |out| was
386 // successfully populated.
387 static bool Populate(const Value& value, ReloadProperties* out);
388
389
390 private:
391 DISALLOW_COPY_AND_ASSIGN(ReloadProperties);
392 };
393
394 scoped_ptr<int> tab_id;
395 scoped_ptr<ReloadProperties> reload_properties;
396
397 ~Params();
398
399 static scoped_ptr<Params> Create(const ListValue& args);
400
401 private:
402 Params();
403
404 DISALLOW_COPY_AND_ASSIGN(Params);
405 };
406
407 class Result {
408 public:
409 static Value* Create();
410
411 private:
412 Result() {};
413 DISALLOW_COPY_AND_ASSIGN(Result);
414 };
415
416 };
417
418 namespace DetectLanguage {
419 struct Params {
420 // Defaults to the active tab of the <a
421 // href='windows.html#current-window'>current window</a>.
422 scoped_ptr<int> tab_id;
423
424 ~Params();
425
426 static scoped_ptr<Params> Create(const ListValue& args);
427
428 private:
429 Params();
430
431 DISALLOW_COPY_AND_ASSIGN(Params);
432 };
433
434 class Result {
435 public:
436 // An ISO language code such as <code>en</code> or <code>fr</code>. For a
437 // complete list of languages supported by this method, see <a
438 // href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/lan gu
439 // ages/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th column s
440 // will be checked and the first non-NULL value will be returned except for
441 // Simplified Chinese for which zh-CN will be returned. For an unknown
442 // language, <code>und</code> will be returned.
443 static Value* Create(const std::string language);
444
445 private:
446 Result() {};
447 DISALLOW_COPY_AND_ASSIGN(Result);
448 };
449
450 };
451
452 namespace InsertCSS {
453 struct Params {
454 // The ID of the tab in which to insert the CSS; defaults to the active tab
455 // of the current window.
456 // Details of the CSS text to insert. Either the code or the file property
457 // must be set, but both may not be set at the same time.
458 // Details of the CSS text to insert. Either the code or the file property m ust
459 // be set, but both may not be set at the same time.
460 struct Details {
461 ~Details();
462 Details();
463
464 // If allFrames is true, this function injects CSS text into all frames of
465 // current page. By default, it's false and CSS is injected only into the top
466 // main frame.
467 scoped_ptr<bool> all_frames;
468
469 // CSS code to be injected.
470 scoped_ptr<std::string> code;
471
472 // CSS file to be injected.
473 scoped_ptr<std::string> file;
474
475 // Populates a Details object from a Value. Returns whether |out| was
476 // successfully populated.
477 static bool Populate(const Value& value, Details* out);
478
479
480 private:
481 DISALLOW_COPY_AND_ASSIGN(Details);
482 };
483
484 scoped_ptr<int> tab_id;
485 Details details;
486
487 ~Params();
488
489 static scoped_ptr<Params> Create(const ListValue& args);
490
491 private:
492 Params();
493
494 DISALLOW_COPY_AND_ASSIGN(Params);
495 };
496
497 class Result {
498 public:
499 static Value* Create();
500
501 private:
502 Result() {};
503 DISALLOW_COPY_AND_ASSIGN(Result);
504 };
505
506 };
507
508 namespace Query {
509 struct Params {
510 struct QueryInfo {
511 ~QueryInfo();
512 QueryInfo();
513
514 // Whether the tabs have completed loading.
515 scoped_ptr<std::string> status;
516
517 // Whether the tabs are pinned.
518 scoped_ptr<bool> pinned;
519
520 // The position of the tabs within their windows.
521 scoped_ptr<int> index;
522
523 // Match tabs against a URL pattern.
524 scoped_ptr<std::string> url;
525
526 // Match page titles against a pattern.
527 scoped_ptr<std::string> title;
528
529 // Whether the tabs are highlighted.
530 scoped_ptr<bool> highlighted;
531
532 // The ID of the parent window, or <a
533 // href='windows.html#property-WINDOW_ID_CURRENT'>chrome.windows.WINDOW_ID _CUR
534 // RENT</a> for the <a href='windows.html#current-window'>current window</ a>.
535 scoped_ptr<int> window_id;
536
537 // The type of window the tabs are in.
538 scoped_ptr<std::string> window_type;
539
540 // Whether the tabs are active in their windows.
541 scoped_ptr<bool> active;
542
543 // Populates a QueryInfo object from a Value. Returns whether |out| was
544 // successfully populated.
545 static bool Populate(const Value& value, QueryInfo* out);
546
547
548 private:
549 DISALLOW_COPY_AND_ASSIGN(QueryInfo);
550 };
551
552 QueryInfo query_info;
553
554 ~Params();
555
556 static scoped_ptr<Params> Create(const ListValue& args);
557
558 private:
559 Params();
560
561 DISALLOW_COPY_AND_ASSIGN(Params);
562 };
563
564 class Result {
565 public:
566 static Value* Create(const std::vector<linked_ptr<Tab> > result);
567
568 private:
569 Result() {};
570 DISALLOW_COPY_AND_ASSIGN(Result);
571 };
572
573 };
574
575 namespace GetSelected {
576 struct Params {
577 // Defaults to the <a href='windows.html#current-window'>current window</a>.
578 scoped_ptr<int> window_id;
579
580 ~Params();
581
582 static scoped_ptr<Params> Create(const ListValue& args);
583
584 private:
585 Params();
586
587 DISALLOW_COPY_AND_ASSIGN(Params);
588 };
589
590 class Result {
591 public:
592 static Value* Create(const Tab& tab);
593
594 private:
595 Result() {};
596 DISALLOW_COPY_AND_ASSIGN(Result);
597 };
598
599 };
600
601 namespace GetAllInWindow {
602 struct Params {
603 // Defaults to the <a href='windows.html#current-window'>current window</a>.
604 scoped_ptr<int> window_id;
605
606 ~Params();
607
608 static scoped_ptr<Params> Create(const ListValue& args);
609
610 private:
611 Params();
612
613 DISALLOW_COPY_AND_ASSIGN(Params);
614 };
615
616 class Result {
617 public:
618 static Value* Create(const std::vector<linked_ptr<Tab> > tabs);
619
620 private:
621 Result() {};
622 DISALLOW_COPY_AND_ASSIGN(Result);
623 };
624
625 };
626
627
628 } // tabs
629 } // api
630 } // extensions
631
632 #endif // CHROME_COMMON_EXTENSIONS_API_TABS_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698