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

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

Powered by Google App Engine
This is Rietveld 408576698