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

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: 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/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 i f
not at google - send to devlin 2012/02/08 05:02:08 looks like the comment wrapping thing got a bit br
calamity 2012/02/08 07:01:18 It wraps to 80 characters but then got indented 2.
49 // 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 // The ID of the tab in which to run the script; defaults to the active tab of
132 // the current window.
133 scoped_ptr<int> tab_id;
134
135 // Details of the script to run. Either the code or the file property must b e
136 // set, but both may not be set at the same time.
137 Details details;
138
139
not at google - send to devlin 2012/02/08 05:02:08 where did this extra blank line come from?
calamity 2012/02/08 07:01:18 Done.
140 ~Params();
141
142 static scoped_ptr<Params> Create(const ListValue& args);
143
144 private:
145 Params();
146
147 DISALLOW_COPY_AND_ASSIGN(Params);
148 };
149
150 class Result {
151 public:
152 static Value* Create();
153
154 private:
155 Result() {};
156 DISALLOW_COPY_AND_ASSIGN(Result);
157 };
158
159 };
160
161 namespace Get {
162 struct Params {
163 int tab_id;
164
165
166 ~Params();
167
168 static scoped_ptr<Params> Create(const ListValue& args);
169
170 private:
171 Params();
172
173 DISALLOW_COPY_AND_ASSIGN(Params);
174 };
175
176 class Result {
177 public:
178 static Value* Create(const Tab& tab);
179
180 private:
181 Result() {};
182 DISALLOW_COPY_AND_ASSIGN(Result);
183 };
184
185 };
186
187 namespace GetCurrent {
188
189 class Result {
190 public:
191 static Value* Create(const scoped_ptr<Tab>& tab);
192
193 private:
194 Result() {};
195 DISALLOW_COPY_AND_ASSIGN(Result);
196 };
197
198 };
199
200 namespace Create {
201 struct Params {
202 struct CreateProperties {
203 ~CreateProperties();
204 CreateProperties();
205
206 // The position the tab should take in the window. The provided value will be
207 // clamped to between zero and the number of tabs in the window.
208 scoped_ptr<int> index;
209
210 // The ID of the tab that opened this tab. If specified, the opener tab mu st be
211 // in the same window as the newly created tab.
212 scoped_ptr<int> opener_tab_id;
213
214 // The URL to navigate the tab to initially. Fully-qualified URLs must inc lude
215 // a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs
216 // will be relative to the current page within the extension. Defaults to the
217 // New Tab Page.
218 scoped_ptr<std::string> url;
219
220 // Whether the tab should become the selected tab in the window. Defaults to
221 // <var>true</var>
222 scoped_ptr<bool> selected;
223
224 // Whether the tab should be pinned. Defaults to <var>false</var>
225 scoped_ptr<bool> pinned;
226
227 // The window to create the new tab in. Defaults to the <a
228 // href='windows.html#current-window'>current window</a>.
229 scoped_ptr<int> window_id;
230
231 // Whether the tab should become the active tab in the window. Defaults to
232 // <var>true</var>
233 scoped_ptr<bool> active;
234
235 // Populates a CreateProperties object from a Value. Returns whether |out| was
236 // successfully populated.
237 static bool Populate(const Value& value, CreateProperties* out);
238
239
240 private:
241 DISALLOW_COPY_AND_ASSIGN(CreateProperties);
242 };
243
244 CreateProperties create_properties;
245
246
247 ~Params();
248
249 static scoped_ptr<Params> Create(const ListValue& args);
250
251 private:
252 Params();
253
254 DISALLOW_COPY_AND_ASSIGN(Params);
255 };
256
257 class Result {
258 public:
259 // Details about the created tab. Will contain the ID of the new tab.
260 static Value* Create(const Tab& tab);
261
262 private:
263 Result() {};
264 DISALLOW_COPY_AND_ASSIGN(Result);
265 };
266
267 };
268
269 namespace Move {
270 struct Params {
271 // The tab or list of tabs to move.
272 struct MoveProperties {
273 ~MoveProperties();
274 MoveProperties();
275
276 // The position to move the window to. The provided value will be clamped to
277 // between zero and the number of tabs in the window.
278 int index;
279
280 // Defaults to the window the tab is currently in.
281 scoped_ptr<int> window_id;
282
283 // Populates a MoveProperties object from a Value. Returns whether |out| w as
284 // successfully populated.
285 static bool Populate(const Value& value, MoveProperties* out);
286
287
288 private:
289 DISALLOW_COPY_AND_ASSIGN(MoveProperties);
290 };
291
292 scoped_ptr<int> tab_ids_integer;
293
294 scoped_ptr<std::vector<int> > tab_ids_array;
295
296 MoveProperties move_properties;
297
298 enum TabIdsType {
299 TAB_IDS_NONE,
300 TAB_IDS_INTEGER,
301 TAB_IDS_ARRAY
302 };
303
304 TabIdsType tab_ids_type;
305
306 ~Params();
307
308 static scoped_ptr<Params> Create(const ListValue& args);
309
310 private:
311 Params();
312
313 DISALLOW_COPY_AND_ASSIGN(Params);
314 };
315
316 class Result {
317 public:
318 static Value* Create(const scoped_ptr<Tab>& tabs_ref);
319 static Value* Create(const scoped_ptr<std::vector<linked_ptr<Tab> > > tabs_a rray);
320
321 private:
322 Result() {};
323 DISALLOW_COPY_AND_ASSIGN(Result);
324 };
325
326 };
327
328 namespace Update {
329 struct Params {
330 // Defaults to the selected tab of the <a
331 // href='windows.html#current-window'>current window</a>.
332 struct UpdateProperties {
333 ~UpdateProperties();
334 UpdateProperties();
335
336 // Adds or removes the tab from the current selection.
337 scoped_ptr<bool> highlighted;
338
339 // The ID of the tab that opened this tab. If specified, the opener tab mu st be
340 // in the same window as this tab.
341 scoped_ptr<int> opener_tab_id;
342
343 // A URL to navigate the tab to.
344 scoped_ptr<std::string> url;
345
346 // Whether the tab should be selected.
347 scoped_ptr<bool> selected;
348
349 // Whether the tab should be pinned.
350 scoped_ptr<bool> pinned;
351
352 // Whether the tab should be active.
353 scoped_ptr<bool> active;
354
355 // Populates a UpdateProperties object from a Value. Returns whether |out| was
356 // successfully populated.
357 static bool Populate(const Value& value, UpdateProperties* out);
358
359
360 private:
361 DISALLOW_COPY_AND_ASSIGN(UpdateProperties);
362 };
363
364 // Defaults to the selected tab of the <a
365 // href='windows.html#current-window'>current window</a>.
366 scoped_ptr<int> tab_id;
367
368 UpdateProperties update_properties;
369
370
371 ~Params();
372
373 static scoped_ptr<Params> Create(const ListValue& args);
374
375 private:
376 Params();
377
378 DISALLOW_COPY_AND_ASSIGN(Params);
379 };
380
381 class Result {
382 public:
383 // Details about the updated tab, or <code>null</code> if the 'tabs'
384 // permission has not been requested.
385 static Value* Create(const scoped_ptr<Tab>& tab);
386
387 private:
388 Result() {};
389 DISALLOW_COPY_AND_ASSIGN(Result);
390 };
391
392 };
393
394 namespace Remove {
395 struct Params {
396 // The tab or list of tabs to close.
397 scoped_ptr<int> tab_ids_integer;
398
399 scoped_ptr<std::vector<int> > tab_ids_array;
400
401 enum TabIdsType {
402 TAB_IDS_NONE,
403 TAB_IDS_INTEGER,
404 TAB_IDS_ARRAY
405 };
406
407 TabIdsType tab_ids_type;
408
409 ~Params();
410
411 static scoped_ptr<Params> Create(const ListValue& args);
412
413 private:
414 Params();
415
416 DISALLOW_COPY_AND_ASSIGN(Params);
417 };
418
419 class Result {
420 public:
421 static Value* Create();
422
423 private:
424 Result() {};
425 DISALLOW_COPY_AND_ASSIGN(Result);
426 };
427
428 };
429
430 namespace CaptureVisibleTab {
431 struct Params {
432 // The target window. Defaults to the <a
433 // href='windows.html#current-window'>current window</a>.
434 // Set parameters of image capture, such as the format of the resulting
435 // image.
436 // Set parameters of image capture, such as the format of the resulting imag e.
437 struct Options {
438 ~Options();
439 Options();
440
441 // When format is 'jpeg', controls the quality of the resulting image. Th is
442 // value is ignored for PNG images. As quality is decreased, the resultin g
443 // image will have more visual artifacts, and the number of bytes needed t o
444 // store it will decrease.
445 scoped_ptr<int> quality;
446
447 // The format of the resulting image. Default is jpeg.
448 scoped_ptr<std::string> format;
449
450 // Populates a Options object from a Value. Returns whether |out| was
451 // successfully populated.
452 static bool Populate(const Value& value, Options* out);
453
454
455 private:
456 DISALLOW_COPY_AND_ASSIGN(Options);
457 };
458
459 // The target window. Defaults to the <a
460 // href='windows.html#current-window'>current window</a>.
461 scoped_ptr<int> window_id;
462
463 // Set parameters of image capture, such as the format of the resulting imag e.
464 scoped_ptr<Options> options;
465
466
467 ~Params();
468
469 static scoped_ptr<Params> Create(const ListValue& args);
470
471 private:
472 Params();
473
474 DISALLOW_COPY_AND_ASSIGN(Params);
475 };
476
477 class Result {
478 public:
479 // A data URL which encodes an image of the visible area of the captured tab .
480 // May be assigned to the 'src' property of an HTML Image element for
481 // display.
482 static Value* Create(const std::string data_url);
483
484 private:
485 Result() {};
486 DISALLOW_COPY_AND_ASSIGN(Result);
487 };
488
489 };
490
491 namespace Reload {
492 struct Params {
493 // The ID of the tab to reload; defaults to the selected tab of the current
494 // window.
495 struct ReloadProperties {
496 ~ReloadProperties();
497 ReloadProperties();
498
499 // Whether using any local cache. Default is false.
500 scoped_ptr<bool> bypass_cache;
501
502 // Populates a ReloadProperties object from a Value. Returns whether |out| was
503 // successfully populated.
504 static bool Populate(const Value& value, ReloadProperties* out);
505
506
507 private:
508 DISALLOW_COPY_AND_ASSIGN(ReloadProperties);
509 };
510
511 // The ID of the tab to reload; defaults to the selected tab of the current
512 // window.
513 scoped_ptr<int> tab_id;
514
515 scoped_ptr<ReloadProperties> reload_properties;
516
517
518 ~Params();
519
520 static scoped_ptr<Params> Create(const ListValue& args);
521
522 private:
523 Params();
524
525 DISALLOW_COPY_AND_ASSIGN(Params);
526 };
527
528 class Result {
529 public:
530 static Value* Create();
531
532 private:
533 Result() {};
534 DISALLOW_COPY_AND_ASSIGN(Result);
535 };
536
537 };
538
539 namespace DetectLanguage {
540 struct Params {
541 // Defaults to the active tab of the <a
542 // href='windows.html#current-window'>current window</a>.
543 // Defaults to the active tab of the <a
544 // href='windows.html#current-window'>current window</a>.
545 scoped_ptr<int> tab_id;
546
547
548 ~Params();
549
550 static scoped_ptr<Params> Create(const ListValue& args);
551
552 private:
553 Params();
554
555 DISALLOW_COPY_AND_ASSIGN(Params);
556 };
557
558 class Result {
559 public:
560 // An ISO language code such as <code>en</code> or <code>fr</code>. For a
561 // complete list of languages supported by this method, see <a
562 // href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/lan gu
563 // ages/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th column s
564 // will be checked and the first non-NULL value will be returned except for
565 // Simplified Chinese for which zh-CN will be returned. For an unknown
566 // language, <code>und</code> will be returned.
567 static Value* Create(const std::string language);
568
569 private:
570 Result() {};
571 DISALLOW_COPY_AND_ASSIGN(Result);
572 };
573
574 };
575
576 namespace InsertCSS {
577 struct Params {
578 // The ID of the tab in which to insert the CSS; defaults to the active tab
579 // of the current window.
580 // Details of the CSS text to insert. Either the code or the file property
581 // must be set, but both may not be set at the same time.
582 // Details of the CSS text to insert. Either the code or the file property m ust
583 // be set, but both may not be set at the same time.
584 struct Details {
585 ~Details();
586 Details();
587
588 // If allFrames is true, this function injects CSS text into all frames of
589 // current page. By default, it's false and CSS is injected only into the top
590 // main frame.
591 scoped_ptr<bool> all_frames;
592
593 // CSS code to be injected.
594 scoped_ptr<std::string> code;
595
596 // CSS file to be injected.
597 scoped_ptr<std::string> file;
598
599 // Populates a Details object from a Value. Returns whether |out| was
600 // successfully populated.
601 static bool Populate(const Value& value, Details* out);
602
603
604 private:
605 DISALLOW_COPY_AND_ASSIGN(Details);
606 };
607
608 // The ID of the tab in which to insert the CSS; defaults to the active tab of
609 // the current window.
610 scoped_ptr<int> tab_id;
611
612 // Details of the CSS text to insert. Either the code or the file property m ust
613 // be set, but both may not be set at the same time.
614 Details details;
615
616
617 ~Params();
618
619 static scoped_ptr<Params> Create(const ListValue& args);
620
621 private:
622 Params();
623
624 DISALLOW_COPY_AND_ASSIGN(Params);
625 };
626
627 class Result {
628 public:
629 static Value* Create();
630
631 private:
632 Result() {};
633 DISALLOW_COPY_AND_ASSIGN(Result);
634 };
635
636 };
637
638 namespace Highlight {
639 struct Params {
640 struct HighlightInfo {
641 ~HighlightInfo();
642 HighlightInfo();
643
644 scoped_ptr<std::vector<int> > tabs_array;
645
646 scoped_ptr<int> tabs_integer;
647
648 // The window that contains the tabs.
649 int window_id;
650
651 enum TabsType {
652 TABS_NONE,
653 TABS_ARRAY,
654 TABS_INTEGER
655 };
656
657 TabsType tabs_type;
658 // Populates a HighlightInfo object from a Value. Returns whether |out| wa s
659 // successfully populated.
660 static bool Populate(const Value& value, HighlightInfo* out);
661
662
663 private:
664 DISALLOW_COPY_AND_ASSIGN(HighlightInfo);
665 };
666
667 HighlightInfo highlight_info;
668
669
670 ~Params();
671
672 static scoped_ptr<Params> Create(const ListValue& args);
673
674 private:
675 Params();
676
677 DISALLOW_COPY_AND_ASSIGN(Params);
678 };
679
680 class Result {
681 public:
682 // Contains details about the window whose tabs were highlighted.
683 static Value* Create(const windows::Window& window);
684
685 private:
686 Result() {};
687 DISALLOW_COPY_AND_ASSIGN(Result);
688 };
689
690 };
691
692 namespace Query {
693 struct Params {
694 struct QueryInfo {
695 ~QueryInfo();
696 QueryInfo();
697
698 // Whether the tabs have completed loading.
699 scoped_ptr<std::string> status;
700
701 // Whether the tabs are pinned.
702 scoped_ptr<bool> pinned;
703
704 // The position of the tabs within their windows.
705 scoped_ptr<int> index;
706
707 // Match tabs against a URL pattern.
708 scoped_ptr<std::string> url;
709
710 // Match page titles against a pattern.
711 scoped_ptr<std::string> title;
712
713 // Whether the tabs are highlighted.
714 scoped_ptr<bool> highlighted;
715
716 // The ID of the parent window, or <a
717 // href='windows.html#property-WINDOW_ID_CURRENT'>chrome.windows.WINDOW_ID _CURRE
718 // NT</a> for the <a href='windows.html#current-window'>current window</a> .
719 scoped_ptr<int> window_id;
720
721 // The type of window the tabs are in.
722 scoped_ptr<std::string> window_type;
723
724 // Whether the tabs are active in their windows.
725 scoped_ptr<bool> active;
726
727 // Populates a QueryInfo object from a Value. Returns whether |out| was
728 // successfully populated.
729 static bool Populate(const Value& value, QueryInfo* out);
730
731
732 private:
733 DISALLOW_COPY_AND_ASSIGN(QueryInfo);
734 };
735
736 QueryInfo query_info;
737
738
739 ~Params();
740
741 static scoped_ptr<Params> Create(const ListValue& args);
742
743 private:
744 Params();
745
746 DISALLOW_COPY_AND_ASSIGN(Params);
747 };
748
749 class Result {
750 public:
751 static Value* Create(const std::vector<linked_ptr<Tab> > result);
752
753 private:
754 Result() {};
755 DISALLOW_COPY_AND_ASSIGN(Result);
756 };
757
758 };
759
760 namespace GetSelected {
761 struct Params {
762 // Defaults to the <a href='windows.html#current-window'>current window</a>.
763 // Defaults to the <a href='windows.html#current-window'>current window</a>.
764 scoped_ptr<int> window_id;
765
766
767 ~Params();
768
769 static scoped_ptr<Params> Create(const ListValue& args);
770
771 private:
772 Params();
773
774 DISALLOW_COPY_AND_ASSIGN(Params);
775 };
776
777 class Result {
778 public:
779 static Value* Create(const Tab& tab);
780
781 private:
782 Result() {};
783 DISALLOW_COPY_AND_ASSIGN(Result);
784 };
785
786 };
787
788 namespace GetAllInWindow {
789 struct Params {
790 // Defaults to the <a href='windows.html#current-window'>current window</a>.
791 // Defaults to the <a href='windows.html#current-window'>current window</a>.
792 scoped_ptr<int> window_id;
793
794
795 ~Params();
796
797 static scoped_ptr<Params> Create(const ListValue& args);
798
799 private:
800 Params();
801
802 DISALLOW_COPY_AND_ASSIGN(Params);
803 };
804
805 class Result {
806 public:
807 static Value* Create(const std::vector<linked_ptr<Tab> > tabs);
808
809 private:
810 Result() {};
811 DISALLOW_COPY_AND_ASSIGN(Result);
812 };
813
814 };
815
816
817 } // tabs
818 } // api
819 } // extensions
820
821 #endif // CHROME_COMMON_EXTENSIONS_API_TABS_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698