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

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

Powered by Google App Engine
This is Rietveld 408576698