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

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

Powered by Google App Engine
This is Rietveld 408576698