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

Side by Side Diff: content/browser/devtools/protocol/devtools_protocol_handler_impl.h

Issue 683733010: NOT FOR COMMIT: Generated code for 642263004 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@singleUse
Patch Set: Created 6 years, 1 month 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 | « no previous file | content/browser/devtools/protocol/devtools_protocol_handler_impl.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 2014 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 // THIS FILE IS AUTOGENERATED. DO NOT EDIT.
6 // Generated by
7 // content/public/browser/devtools_protocol_handler_generator.py from
8 // third_party/WebKit/Source/devtools/protocol.json
9
10 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_IMPL_H_
11 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_IMPL_H_
12
13 #include "content/browser/devtools/devtools_protocol.h"
14 #include "content/browser/devtools/protocol/devtools_protocol_client.h"
15
16 namespace content {
17
18 class DevToolsProtocolHandlerImpl;
19
20 namespace devtools {
21
22 class ListBuilderBase {
23 public:
24 static scoped_ptr<base::ListValue> ToValue(ListBuilderBase src);
25
26 protected:
27 ListBuilderBase();
28 ListBuilderBase(scoped_ptr<base::ListValue> list_);
29
30 scoped_ptr<base::ListValue> list_;
31 };
32
33 template<class T>
34 class ListBuilder : public ListBuilderBase {
35 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ListBuilder)
36 public:
37 ListBuilder() {}
38 ListBuilder(ListBuilder&& other) : ListBuilderBase(other.list_.Pass()) {
39 }
40
41 void push_back(T item) {
42 list_->Append(T::ToValue(item.Pass()).release());
43 }
44 };
45
46 template<>
47 class ListBuilder<std::string> : public ListBuilderBase {
48 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ListBuilder)
49 public:
50 ListBuilder() {}
51 ListBuilder(ListBuilder&& other) : ListBuilderBase(other.list_.Pass()) {
52 }
53
54 void push_back(const std::string& item) {
55 list_->AppendString(item);
56 }
57 };
58
59 namespace inspector {
60 template<int MASK>
61 struct DetachedParamsBuilder {
62 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(DetachedParamsBuilder)
63 public:
64 enum {
65 kAllSet = 0,
66 kReason = 1 << 0,
67 kNoneSet = kReason
68 };
69
70 DetachedParamsBuilder<MASK & ~kReason>&
71 set_reason(const std::string& reason) {
72 COMPILE_ASSERT(MASK & kReason, already_set);
73 dict_->SetString("reason", reason);
74 return ThisAs<DetachedParamsBuilder<MASK & ~kReason>>();
75 }
76
77 static DetachedParamsBuilder<kNoneSet> Create() {
78 return DetachedParamsBuilder<kNoneSet>();
79 }
80
81 static scoped_ptr<base::DictionaryValue> ToValue(
82 DetachedParamsBuilder src) {
83 return src.dict_.Pass();
84 }
85
86 DetachedParamsBuilder(DetachedParamsBuilder&& other)
87 : dict_(other.dict_.Pass()) {
88 }
89
90 private:
91 friend struct DetachedParamsBuilder<0>;
92
93 DetachedParamsBuilder() : dict_(new base::DictionaryValue()) {
94 }
95
96 template<class T> T& ThisAs() {
97 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
98 return *reinterpret_cast<T*>(this);
99 }
100
101 scoped_ptr<base::DictionaryValue> dict_;
102 };
103
104 typedef DetachedParamsBuilder<0> DetachedParams;
105
106 } // namespace inspector
107
108 namespace inspector {
109 template<int MASK>
110 struct TargetCrashedParamsBuilder {
111 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(TargetCrashedParamsBuilder)
112 public:
113 enum {
114 kAllSet = 0,
115 kNoneSet = kAllSet
116 };
117
118
119 static TargetCrashedParamsBuilder<kNoneSet> Create() {
120 return TargetCrashedParamsBuilder<kNoneSet>();
121 }
122
123 static scoped_ptr<base::DictionaryValue> ToValue(
124 TargetCrashedParamsBuilder src) {
125 return src.dict_.Pass();
126 }
127
128 TargetCrashedParamsBuilder(TargetCrashedParamsBuilder&& other)
129 : dict_(other.dict_.Pass()) {
130 }
131
132 private:
133 friend struct TargetCrashedParamsBuilder<0>;
134
135 TargetCrashedParamsBuilder() : dict_(new base::DictionaryValue()) {
136 }
137
138 template<class T> T& ThisAs() {
139 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
140 return *reinterpret_cast<T*>(this);
141 }
142
143 scoped_ptr<base::DictionaryValue> dict_;
144 };
145
146 typedef TargetCrashedParamsBuilder<0> TargetCrashedParams;
147
148 } // namespace inspector
149
150 namespace inspector {
151 class InspectorHandler;
152 } // namespace domain
153
154 namespace inspector {
155 class Client : public DevToolsProtocolClient {
156 public:
157 Client(const RawMessageCallback& raw_message_callback);
158 virtual ~Client();
159
160 void Detached(
161 DetachedParams params);
162 void TargetCrashed(
163 TargetCrashedParams params);
164 };
165 } // namespace inspector
166
167 namespace page {
168 typedef std::string FrameId;
169 } // namespace page
170
171 namespace page {
172 template<int MASK>
173 struct NavigationEntryBuilder {
174 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(NavigationEntryBuilder)
175 public:
176 enum {
177 kAllSet = 0,
178 kId = 1 << 0,
179 kUrl = 1 << 1,
180 kTitle = 1 << 2,
181 kNoneSet = kId | kUrl | kTitle
182 };
183
184 NavigationEntryBuilder<MASK & ~kId>&
185 set_id(int id) {
186 COMPILE_ASSERT(MASK & kId, already_set);
187 dict_->SetInteger("id", id);
188 return ThisAs<NavigationEntryBuilder<MASK & ~kId>>();
189 }
190
191 NavigationEntryBuilder<MASK & ~kUrl>&
192 set_url(const std::string& url) {
193 COMPILE_ASSERT(MASK & kUrl, already_set);
194 dict_->SetString("url", url);
195 return ThisAs<NavigationEntryBuilder<MASK & ~kUrl>>();
196 }
197
198 NavigationEntryBuilder<MASK & ~kTitle>&
199 set_title(const std::string& title) {
200 COMPILE_ASSERT(MASK & kTitle, already_set);
201 dict_->SetString("title", title);
202 return ThisAs<NavigationEntryBuilder<MASK & ~kTitle>>();
203 }
204
205 static NavigationEntryBuilder<kNoneSet> Create() {
206 return NavigationEntryBuilder<kNoneSet>();
207 }
208
209 static scoped_ptr<base::DictionaryValue> ToValue(
210 NavigationEntryBuilder src) {
211 return src.dict_.Pass();
212 }
213
214 NavigationEntryBuilder(NavigationEntryBuilder&& other)
215 : dict_(other.dict_.Pass()) {
216 }
217
218 private:
219 friend struct NavigationEntryBuilder<0>;
220
221 NavigationEntryBuilder() : dict_(new base::DictionaryValue()) {
222 }
223
224 template<class T> T& ThisAs() {
225 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
226 return *reinterpret_cast<T*>(this);
227 }
228
229 scoped_ptr<base::DictionaryValue> dict_;
230 };
231
232 typedef NavigationEntryBuilder<0> NavigationEntry;
233
234 } // namespace page
235
236 namespace page {
237 template<int MASK>
238 struct CaptureScreenshotResponseBuilder {
239 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(CaptureScreenshotResponseBuild er)
240 public:
241 enum {
242 kAllSet = 0,
243 kData = 1 << 0,
244 kNoneSet = kData
245 };
246
247 CaptureScreenshotResponseBuilder<MASK & ~kData>&
248 set_data(const std::string& data) {
249 COMPILE_ASSERT(MASK & kData, already_set);
250 dict_->SetString("data", data);
251 return ThisAs<CaptureScreenshotResponseBuilder<MASK & ~kData>>();
252 }
253
254 static CaptureScreenshotResponseBuilder<kNoneSet> Create() {
255 return CaptureScreenshotResponseBuilder<kNoneSet>();
256 }
257
258 static scoped_ptr<base::DictionaryValue> ToValue(
259 CaptureScreenshotResponseBuilder src) {
260 return src.dict_.Pass();
261 }
262
263 CaptureScreenshotResponseBuilder(CaptureScreenshotResponseBuilder&& other)
264 : dict_(other.dict_.Pass()) {
265 }
266
267 private:
268 friend struct CaptureScreenshotResponseBuilder<0>;
269
270 CaptureScreenshotResponseBuilder() : dict_(new base::DictionaryValue()) {
271 }
272
273 template<class T> T& ThisAs() {
274 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
275 return *reinterpret_cast<T*>(this);
276 }
277
278 scoped_ptr<base::DictionaryValue> dict_;
279 };
280
281 typedef CaptureScreenshotResponseBuilder<0> CaptureScreenshotResponse;
282
283 } // namespace page
284
285 namespace page {
286 namespace start_screencast {
287 extern const char kFormatJpeg[];
288 extern const char kFormatPng[];
289 } // namespace start_screencast
290 } // namespace page
291
292 namespace page {
293 template<int MASK>
294 struct QuotaBuilder {
295 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(QuotaBuilder)
296 public:
297 enum {
298 kAllSet = 0,
299 kTemporary = 1 << 0,
300 kPersistent = 1 << 1,
301 kNoneSet = kTemporary | kPersistent
302 };
303
304 QuotaBuilder<MASK & ~kTemporary>&
305 set_temporary(double temporary) {
306 COMPILE_ASSERT(MASK & kTemporary, already_set);
307 dict_->SetDouble("temporary", temporary);
308 return ThisAs<QuotaBuilder<MASK & ~kTemporary>>();
309 }
310
311 QuotaBuilder<MASK & ~kPersistent>&
312 set_persistent(double persistent) {
313 COMPILE_ASSERT(MASK & kPersistent, already_set);
314 dict_->SetDouble("persistent", persistent);
315 return ThisAs<QuotaBuilder<MASK & ~kPersistent>>();
316 }
317
318 static QuotaBuilder<kNoneSet> Create() {
319 return QuotaBuilder<kNoneSet>();
320 }
321
322 static scoped_ptr<base::DictionaryValue> ToValue(
323 QuotaBuilder src) {
324 return src.dict_.Pass();
325 }
326
327 QuotaBuilder(QuotaBuilder&& other)
328 : dict_(other.dict_.Pass()) {
329 }
330
331 private:
332 friend struct QuotaBuilder<0>;
333
334 QuotaBuilder() : dict_(new base::DictionaryValue()) {
335 }
336
337 template<class T> T& ThisAs() {
338 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
339 return *reinterpret_cast<T*>(this);
340 }
341
342 scoped_ptr<base::DictionaryValue> dict_;
343 };
344
345 typedef QuotaBuilder<0> Quota;
346
347 } // namespace page
348
349 namespace page {
350 namespace usage_item {
351 extern const char kIdFilesystem[];
352 extern const char kIdDatabase[];
353 extern const char kIdAppcache[];
354 extern const char kIdIndexeddatabase[];
355 } // namespace usage_item
356 } // namespace page
357
358 namespace page {
359 template<int MASK>
360 struct UsageItemBuilder {
361 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(UsageItemBuilder)
362 public:
363 enum {
364 kAllSet = 0,
365 kId = 1 << 0,
366 kValue = 1 << 1,
367 kNoneSet = kId | kValue
368 };
369
370 UsageItemBuilder<MASK & ~kId>&
371 set_id(const std::string& id) {
372 COMPILE_ASSERT(MASK & kId, already_set);
373 dict_->SetString("id", id);
374 return ThisAs<UsageItemBuilder<MASK & ~kId>>();
375 }
376
377 UsageItemBuilder<MASK & ~kValue>&
378 set_value(double value) {
379 COMPILE_ASSERT(MASK & kValue, already_set);
380 dict_->SetDouble("value", value);
381 return ThisAs<UsageItemBuilder<MASK & ~kValue>>();
382 }
383
384 static UsageItemBuilder<kNoneSet> Create() {
385 return UsageItemBuilder<kNoneSet>();
386 }
387
388 static scoped_ptr<base::DictionaryValue> ToValue(
389 UsageItemBuilder src) {
390 return src.dict_.Pass();
391 }
392
393 UsageItemBuilder(UsageItemBuilder&& other)
394 : dict_(other.dict_.Pass()) {
395 }
396
397 private:
398 friend struct UsageItemBuilder<0>;
399
400 UsageItemBuilder() : dict_(new base::DictionaryValue()) {
401 }
402
403 template<class T> T& ThisAs() {
404 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
405 return *reinterpret_cast<T*>(this);
406 }
407
408 scoped_ptr<base::DictionaryValue> dict_;
409 };
410
411 typedef UsageItemBuilder<0> UsageItem;
412
413 } // namespace page
414
415 namespace page {
416 template<int MASK>
417 struct UsageBuilder {
418 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(UsageBuilder)
419 public:
420 enum {
421 kAllSet = 0,
422 kTemporary = 1 << 0,
423 kPersistent = 1 << 1,
424 kSyncable = 1 << 2,
425 kNoneSet = kTemporary | kPersistent | kSyncable
426 };
427
428 UsageBuilder<MASK & ~kTemporary>&
429 set_temporary(devtools::ListBuilder<devtools::page::UsageItem> temporary) {
430 COMPILE_ASSERT(MASK & kTemporary, already_set);
431 dict_->Set("temporary",
432 devtools::ListBuilder<devtools::page::UsageItem>::ToValue(temporary.Pass ()).release());
433 return ThisAs<UsageBuilder<MASK & ~kTemporary>>();
434 }
435
436 UsageBuilder<MASK & ~kPersistent>&
437 set_persistent(devtools::ListBuilder<devtools::page::UsageItem> persistent) {
438 COMPILE_ASSERT(MASK & kPersistent, already_set);
439 dict_->Set("persistent",
440 devtools::ListBuilder<devtools::page::UsageItem>::ToValue(persistent.Pas s()).release());
441 return ThisAs<UsageBuilder<MASK & ~kPersistent>>();
442 }
443
444 UsageBuilder<MASK & ~kSyncable>&
445 set_syncable(devtools::ListBuilder<devtools::page::UsageItem> syncable) {
446 COMPILE_ASSERT(MASK & kSyncable, already_set);
447 dict_->Set("syncable",
448 devtools::ListBuilder<devtools::page::UsageItem>::ToValue(syncable.Pass( )).release());
449 return ThisAs<UsageBuilder<MASK & ~kSyncable>>();
450 }
451
452 static UsageBuilder<kNoneSet> Create() {
453 return UsageBuilder<kNoneSet>();
454 }
455
456 static scoped_ptr<base::DictionaryValue> ToValue(
457 UsageBuilder src) {
458 return src.dict_.Pass();
459 }
460
461 UsageBuilder(UsageBuilder&& other)
462 : dict_(other.dict_.Pass()) {
463 }
464
465 private:
466 friend struct UsageBuilder<0>;
467
468 UsageBuilder() : dict_(new base::DictionaryValue()) {
469 }
470
471 template<class T> T& ThisAs() {
472 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
473 return *reinterpret_cast<T*>(this);
474 }
475
476 scoped_ptr<base::DictionaryValue> dict_;
477 };
478
479 typedef UsageBuilder<0> Usage;
480
481 } // namespace page
482
483 namespace page {
484 template<int MASK>
485 struct QueryUsageAndQuotaResponseBuilder {
486 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(QueryUsageAndQuotaResponseBuil der)
487 public:
488 enum {
489 kAllSet = 0,
490 kQuota = 1 << 0,
491 kUsage = 1 << 1,
492 kNoneSet = kQuota | kUsage
493 };
494
495 QueryUsageAndQuotaResponseBuilder<MASK & ~kQuota>&
496 set_quota(devtools::page::Quota quota) {
497 COMPILE_ASSERT(MASK & kQuota, already_set);
498 dict_->Set("quota",
499 devtools::page::Quota::ToValue(quota.Pass()).release());
500 return ThisAs<QueryUsageAndQuotaResponseBuilder<MASK & ~kQuota>>();
501 }
502
503 QueryUsageAndQuotaResponseBuilder<MASK & ~kUsage>&
504 set_usage(devtools::page::Usage usage) {
505 COMPILE_ASSERT(MASK & kUsage, already_set);
506 dict_->Set("usage",
507 devtools::page::Usage::ToValue(usage.Pass()).release());
508 return ThisAs<QueryUsageAndQuotaResponseBuilder<MASK & ~kUsage>>();
509 }
510
511 static QueryUsageAndQuotaResponseBuilder<kNoneSet> Create() {
512 return QueryUsageAndQuotaResponseBuilder<kNoneSet>();
513 }
514
515 static scoped_ptr<base::DictionaryValue> ToValue(
516 QueryUsageAndQuotaResponseBuilder src) {
517 return src.dict_.Pass();
518 }
519
520 QueryUsageAndQuotaResponseBuilder(QueryUsageAndQuotaResponseBuilder&& other)
521 : dict_(other.dict_.Pass()) {
522 }
523
524 private:
525 friend struct QueryUsageAndQuotaResponseBuilder<0>;
526
527 QueryUsageAndQuotaResponseBuilder() : dict_(new base::DictionaryValue()) {
528 }
529
530 template<class T> T& ThisAs() {
531 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
532 return *reinterpret_cast<T*>(this);
533 }
534
535 scoped_ptr<base::DictionaryValue> dict_;
536 };
537
538 typedef QueryUsageAndQuotaResponseBuilder<0> QueryUsageAndQuotaResponse;
539
540 } // namespace page
541
542 namespace dom {
543 template<int MASK>
544 struct RectBuilder {
545 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(RectBuilder)
546 public:
547 enum {
548 kAllSet = 0,
549 kX = 1 << 0,
550 kY = 1 << 1,
551 kWidth = 1 << 2,
552 kHeight = 1 << 3,
553 kNoneSet = kX | kY | kWidth | kHeight
554 };
555
556 RectBuilder<MASK & ~kX>&
557 set_x(double x) {
558 COMPILE_ASSERT(MASK & kX, already_set);
559 dict_->SetDouble("x", x);
560 return ThisAs<RectBuilder<MASK & ~kX>>();
561 }
562
563 RectBuilder<MASK & ~kY>&
564 set_y(double y) {
565 COMPILE_ASSERT(MASK & kY, already_set);
566 dict_->SetDouble("y", y);
567 return ThisAs<RectBuilder<MASK & ~kY>>();
568 }
569
570 RectBuilder<MASK & ~kWidth>&
571 set_width(double width) {
572 COMPILE_ASSERT(MASK & kWidth, already_set);
573 dict_->SetDouble("width", width);
574 return ThisAs<RectBuilder<MASK & ~kWidth>>();
575 }
576
577 RectBuilder<MASK & ~kHeight>&
578 set_height(double height) {
579 COMPILE_ASSERT(MASK & kHeight, already_set);
580 dict_->SetDouble("height", height);
581 return ThisAs<RectBuilder<MASK & ~kHeight>>();
582 }
583
584 static RectBuilder<kNoneSet> Create() {
585 return RectBuilder<kNoneSet>();
586 }
587
588 static scoped_ptr<base::DictionaryValue> ToValue(
589 RectBuilder src) {
590 return src.dict_.Pass();
591 }
592
593 RectBuilder(RectBuilder&& other)
594 : dict_(other.dict_.Pass()) {
595 }
596
597 private:
598 friend struct RectBuilder<0>;
599
600 RectBuilder() : dict_(new base::DictionaryValue()) {
601 }
602
603 template<class T> T& ThisAs() {
604 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
605 return *reinterpret_cast<T*>(this);
606 }
607
608 scoped_ptr<base::DictionaryValue> dict_;
609 };
610
611 typedef RectBuilder<0> Rect;
612
613 } // namespace dom
614
615 namespace page {
616 template<int MASK>
617 struct ScreencastFrameMetadataBuilder {
618 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ScreencastFrameMetadataBuilder )
619 public:
620 enum {
621 kAllSet = 0,
622 kDeviceScaleFactor = 1 << 0,
623 kViewport = 1 << 1,
624 kPageScaleFactor = 1 << 2,
625 kPageScaleFactorMin = 1 << 3,
626 kPageScaleFactorMax = 1 << 4,
627 kDeviceWidth = 1 << 5,
628 kDeviceHeight = 1 << 6,
629 kScrollOffsetX = 1 << 7,
630 kScrollOffsetY = 1 << 8,
631 kNoneSet = kDeviceScaleFactor | kViewport | kPageScaleFactor | kPageScaleFac torMin | kPageScaleFactorMax | kDeviceWidth | kDeviceHeight | kScrollOffsetX | k ScrollOffsetY
632 };
633
634 ScreencastFrameMetadataBuilder<MASK & ~kDeviceScaleFactor>&
635 set_device_scale_factor(double device_scale_factor) {
636 COMPILE_ASSERT(MASK & kDeviceScaleFactor, already_set);
637 dict_->SetDouble("deviceScaleFactor", device_scale_factor);
638 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kDeviceScaleFactor>>();
639 }
640
641 ScreencastFrameMetadataBuilder<MASK & ~kViewport>&
642 set_viewport(devtools::dom::Rect viewport) {
643 COMPILE_ASSERT(MASK & kViewport, already_set);
644 dict_->Set("viewport",
645 devtools::dom::Rect::ToValue(viewport.Pass()).release());
646 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kViewport>>();
647 }
648
649 ScreencastFrameMetadataBuilder<MASK>&
650 set_offset_top(double offset_top) {
651 dict_->SetDouble("offsetTop", offset_top);
652 return *this;
653 }
654
655 ScreencastFrameMetadataBuilder<MASK>&
656 set_offset_bottom(double offset_bottom) {
657 dict_->SetDouble("offsetBottom", offset_bottom);
658 return *this;
659 }
660
661 ScreencastFrameMetadataBuilder<MASK & ~kPageScaleFactor>&
662 set_page_scale_factor(double page_scale_factor) {
663 COMPILE_ASSERT(MASK & kPageScaleFactor, already_set);
664 dict_->SetDouble("pageScaleFactor", page_scale_factor);
665 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kPageScaleFactor>>();
666 }
667
668 ScreencastFrameMetadataBuilder<MASK & ~kPageScaleFactorMin>&
669 set_page_scale_factor_min(double page_scale_factor_min) {
670 COMPILE_ASSERT(MASK & kPageScaleFactorMin, already_set);
671 dict_->SetDouble("pageScaleFactorMin", page_scale_factor_min);
672 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kPageScaleFactorMin>>() ;
673 }
674
675 ScreencastFrameMetadataBuilder<MASK & ~kPageScaleFactorMax>&
676 set_page_scale_factor_max(double page_scale_factor_max) {
677 COMPILE_ASSERT(MASK & kPageScaleFactorMax, already_set);
678 dict_->SetDouble("pageScaleFactorMax", page_scale_factor_max);
679 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kPageScaleFactorMax>>() ;
680 }
681
682 ScreencastFrameMetadataBuilder<MASK & ~kDeviceWidth>&
683 set_device_width(double device_width) {
684 COMPILE_ASSERT(MASK & kDeviceWidth, already_set);
685 dict_->SetDouble("deviceWidth", device_width);
686 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kDeviceWidth>>();
687 }
688
689 ScreencastFrameMetadataBuilder<MASK & ~kDeviceHeight>&
690 set_device_height(double device_height) {
691 COMPILE_ASSERT(MASK & kDeviceHeight, already_set);
692 dict_->SetDouble("deviceHeight", device_height);
693 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kDeviceHeight>>();
694 }
695
696 ScreencastFrameMetadataBuilder<MASK & ~kScrollOffsetX>&
697 set_scroll_offset_x(double scroll_offset_x) {
698 COMPILE_ASSERT(MASK & kScrollOffsetX, already_set);
699 dict_->SetDouble("scrollOffsetX", scroll_offset_x);
700 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kScrollOffsetX>>();
701 }
702
703 ScreencastFrameMetadataBuilder<MASK & ~kScrollOffsetY>&
704 set_scroll_offset_y(double scroll_offset_y) {
705 COMPILE_ASSERT(MASK & kScrollOffsetY, already_set);
706 dict_->SetDouble("scrollOffsetY", scroll_offset_y);
707 return ThisAs<ScreencastFrameMetadataBuilder<MASK & ~kScrollOffsetY>>();
708 }
709
710 static ScreencastFrameMetadataBuilder<kNoneSet> Create() {
711 return ScreencastFrameMetadataBuilder<kNoneSet>();
712 }
713
714 static scoped_ptr<base::DictionaryValue> ToValue(
715 ScreencastFrameMetadataBuilder src) {
716 return src.dict_.Pass();
717 }
718
719 ScreencastFrameMetadataBuilder(ScreencastFrameMetadataBuilder&& other)
720 : dict_(other.dict_.Pass()) {
721 }
722
723 private:
724 friend struct ScreencastFrameMetadataBuilder<0>;
725
726 ScreencastFrameMetadataBuilder() : dict_(new base::DictionaryValue()) {
727 }
728
729 template<class T> T& ThisAs() {
730 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
731 return *reinterpret_cast<T*>(this);
732 }
733
734 scoped_ptr<base::DictionaryValue> dict_;
735 };
736
737 typedef ScreencastFrameMetadataBuilder<0> ScreencastFrameMetadata;
738
739 } // namespace page
740
741 namespace page {
742 template<int MASK>
743 struct ScreencastFrameParamsBuilder {
744 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ScreencastFrameParamsBuilder)
745 public:
746 enum {
747 kAllSet = 0,
748 kData = 1 << 0,
749 kMetadata = 1 << 1,
750 kNoneSet = kData | kMetadata
751 };
752
753 ScreencastFrameParamsBuilder<MASK & ~kData>&
754 set_data(const std::string& data) {
755 COMPILE_ASSERT(MASK & kData, already_set);
756 dict_->SetString("data", data);
757 return ThisAs<ScreencastFrameParamsBuilder<MASK & ~kData>>();
758 }
759
760 ScreencastFrameParamsBuilder<MASK & ~kMetadata>&
761 set_metadata(devtools::page::ScreencastFrameMetadata metadata) {
762 COMPILE_ASSERT(MASK & kMetadata, already_set);
763 dict_->Set("metadata",
764 devtools::page::ScreencastFrameMetadata::ToValue(metadata.Pass()).releas e());
765 return ThisAs<ScreencastFrameParamsBuilder<MASK & ~kMetadata>>();
766 }
767
768 static ScreencastFrameParamsBuilder<kNoneSet> Create() {
769 return ScreencastFrameParamsBuilder<kNoneSet>();
770 }
771
772 static scoped_ptr<base::DictionaryValue> ToValue(
773 ScreencastFrameParamsBuilder src) {
774 return src.dict_.Pass();
775 }
776
777 ScreencastFrameParamsBuilder(ScreencastFrameParamsBuilder&& other)
778 : dict_(other.dict_.Pass()) {
779 }
780
781 private:
782 friend struct ScreencastFrameParamsBuilder<0>;
783
784 ScreencastFrameParamsBuilder() : dict_(new base::DictionaryValue()) {
785 }
786
787 template<class T> T& ThisAs() {
788 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
789 return *reinterpret_cast<T*>(this);
790 }
791
792 scoped_ptr<base::DictionaryValue> dict_;
793 };
794
795 typedef ScreencastFrameParamsBuilder<0> ScreencastFrameParams;
796
797 } // namespace page
798
799 namespace page {
800 template<int MASK>
801 struct ScreencastVisibilityChangedParamsBuilder {
802 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ScreencastVisibilityChangedPar amsBuilder)
803 public:
804 enum {
805 kAllSet = 0,
806 kVisible = 1 << 0,
807 kNoneSet = kVisible
808 };
809
810 ScreencastVisibilityChangedParamsBuilder<MASK & ~kVisible>&
811 set_visible(bool visible) {
812 COMPILE_ASSERT(MASK & kVisible, already_set);
813 dict_->SetBoolean("visible", visible);
814 return ThisAs<ScreencastVisibilityChangedParamsBuilder<MASK & ~kVisible>>();
815 }
816
817 static ScreencastVisibilityChangedParamsBuilder<kNoneSet> Create() {
818 return ScreencastVisibilityChangedParamsBuilder<kNoneSet>();
819 }
820
821 static scoped_ptr<base::DictionaryValue> ToValue(
822 ScreencastVisibilityChangedParamsBuilder src) {
823 return src.dict_.Pass();
824 }
825
826 ScreencastVisibilityChangedParamsBuilder(ScreencastVisibilityChangedParamsBuil der&& other)
827 : dict_(other.dict_.Pass()) {
828 }
829
830 private:
831 friend struct ScreencastVisibilityChangedParamsBuilder<0>;
832
833 ScreencastVisibilityChangedParamsBuilder() : dict_(new base::DictionaryValue() ) {
834 }
835
836 template<class T> T& ThisAs() {
837 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
838 return *reinterpret_cast<T*>(this);
839 }
840
841 scoped_ptr<base::DictionaryValue> dict_;
842 };
843
844 typedef ScreencastVisibilityChangedParamsBuilder<0> ScreencastVisibilityChangedP arams;
845
846 } // namespace page
847
848 namespace dom {
849 template<int MASK>
850 struct RGBABuilder {
851 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(RGBABuilder)
852 public:
853 enum {
854 kAllSet = 0,
855 kR = 1 << 0,
856 kG = 1 << 1,
857 kB = 1 << 2,
858 kNoneSet = kR | kG | kB
859 };
860
861 RGBABuilder<MASK & ~kR>&
862 set_r(int r) {
863 COMPILE_ASSERT(MASK & kR, already_set);
864 dict_->SetInteger("r", r);
865 return ThisAs<RGBABuilder<MASK & ~kR>>();
866 }
867
868 RGBABuilder<MASK & ~kG>&
869 set_g(int g) {
870 COMPILE_ASSERT(MASK & kG, already_set);
871 dict_->SetInteger("g", g);
872 return ThisAs<RGBABuilder<MASK & ~kG>>();
873 }
874
875 RGBABuilder<MASK & ~kB>&
876 set_b(int b) {
877 COMPILE_ASSERT(MASK & kB, already_set);
878 dict_->SetInteger("b", b);
879 return ThisAs<RGBABuilder<MASK & ~kB>>();
880 }
881
882 RGBABuilder<MASK>&
883 set_a(double a) {
884 dict_->SetDouble("a", a);
885 return *this;
886 }
887
888 static RGBABuilder<kNoneSet> Create() {
889 return RGBABuilder<kNoneSet>();
890 }
891
892 static scoped_ptr<base::DictionaryValue> ToValue(
893 RGBABuilder src) {
894 return src.dict_.Pass();
895 }
896
897 RGBABuilder(RGBABuilder&& other)
898 : dict_(other.dict_.Pass()) {
899 }
900
901 private:
902 friend struct RGBABuilder<0>;
903
904 RGBABuilder() : dict_(new base::DictionaryValue()) {
905 }
906
907 template<class T> T& ThisAs() {
908 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
909 return *reinterpret_cast<T*>(this);
910 }
911
912 scoped_ptr<base::DictionaryValue> dict_;
913 };
914
915 typedef RGBABuilder<0> RGBA;
916
917 } // namespace dom
918
919 namespace page {
920 template<int MASK>
921 struct ColorPickedParamsBuilder {
922 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ColorPickedParamsBuilder)
923 public:
924 enum {
925 kAllSet = 0,
926 kColor = 1 << 0,
927 kNoneSet = kColor
928 };
929
930 ColorPickedParamsBuilder<MASK & ~kColor>&
931 set_color(devtools::dom::RGBA color) {
932 COMPILE_ASSERT(MASK & kColor, already_set);
933 dict_->Set("color",
934 devtools::dom::RGBA::ToValue(color.Pass()).release());
935 return ThisAs<ColorPickedParamsBuilder<MASK & ~kColor>>();
936 }
937
938 static ColorPickedParamsBuilder<kNoneSet> Create() {
939 return ColorPickedParamsBuilder<kNoneSet>();
940 }
941
942 static scoped_ptr<base::DictionaryValue> ToValue(
943 ColorPickedParamsBuilder src) {
944 return src.dict_.Pass();
945 }
946
947 ColorPickedParamsBuilder(ColorPickedParamsBuilder&& other)
948 : dict_(other.dict_.Pass()) {
949 }
950
951 private:
952 friend struct ColorPickedParamsBuilder<0>;
953
954 ColorPickedParamsBuilder() : dict_(new base::DictionaryValue()) {
955 }
956
957 template<class T> T& ThisAs() {
958 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
959 return *reinterpret_cast<T*>(this);
960 }
961
962 scoped_ptr<base::DictionaryValue> dict_;
963 };
964
965 typedef ColorPickedParamsBuilder<0> ColorPickedParams;
966
967 } // namespace page
968
969 namespace page {
970 template<int MASK>
971 struct InterstitialShownParamsBuilder {
972 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(InterstitialShownParamsBuilder )
973 public:
974 enum {
975 kAllSet = 0,
976 kNoneSet = kAllSet
977 };
978
979
980 static InterstitialShownParamsBuilder<kNoneSet> Create() {
981 return InterstitialShownParamsBuilder<kNoneSet>();
982 }
983
984 static scoped_ptr<base::DictionaryValue> ToValue(
985 InterstitialShownParamsBuilder src) {
986 return src.dict_.Pass();
987 }
988
989 InterstitialShownParamsBuilder(InterstitialShownParamsBuilder&& other)
990 : dict_(other.dict_.Pass()) {
991 }
992
993 private:
994 friend struct InterstitialShownParamsBuilder<0>;
995
996 InterstitialShownParamsBuilder() : dict_(new base::DictionaryValue()) {
997 }
998
999 template<class T> T& ThisAs() {
1000 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1001 return *reinterpret_cast<T*>(this);
1002 }
1003
1004 scoped_ptr<base::DictionaryValue> dict_;
1005 };
1006
1007 typedef InterstitialShownParamsBuilder<0> InterstitialShownParams;
1008
1009 } // namespace page
1010
1011 namespace page {
1012 template<int MASK>
1013 struct InterstitialHiddenParamsBuilder {
1014 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(InterstitialHiddenParamsBuilde r)
1015 public:
1016 enum {
1017 kAllSet = 0,
1018 kNoneSet = kAllSet
1019 };
1020
1021
1022 static InterstitialHiddenParamsBuilder<kNoneSet> Create() {
1023 return InterstitialHiddenParamsBuilder<kNoneSet>();
1024 }
1025
1026 static scoped_ptr<base::DictionaryValue> ToValue(
1027 InterstitialHiddenParamsBuilder src) {
1028 return src.dict_.Pass();
1029 }
1030
1031 InterstitialHiddenParamsBuilder(InterstitialHiddenParamsBuilder&& other)
1032 : dict_(other.dict_.Pass()) {
1033 }
1034
1035 private:
1036 friend struct InterstitialHiddenParamsBuilder<0>;
1037
1038 InterstitialHiddenParamsBuilder() : dict_(new base::DictionaryValue()) {
1039 }
1040
1041 template<class T> T& ThisAs() {
1042 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1043 return *reinterpret_cast<T*>(this);
1044 }
1045
1046 scoped_ptr<base::DictionaryValue> dict_;
1047 };
1048
1049 typedef InterstitialHiddenParamsBuilder<0> InterstitialHiddenParams;
1050
1051 } // namespace page
1052
1053 namespace page {
1054 class PageHandler;
1055 } // namespace domain
1056
1057 namespace page {
1058 class Client : public DevToolsProtocolClient {
1059 public:
1060 Client(const RawMessageCallback& raw_message_callback);
1061 virtual ~Client();
1062
1063 void SendCaptureScreenshotResponse(
1064 scoped_refptr<DevToolsProtocol::Command> command,
1065 CaptureScreenshotResponse params);
1066 void SendQueryUsageAndQuotaResponse(
1067 scoped_refptr<DevToolsProtocol::Command> command,
1068 QueryUsageAndQuotaResponse params);
1069 void ScreencastFrame(
1070 ScreencastFrameParams params);
1071 void ScreencastVisibilityChanged(
1072 ScreencastVisibilityChangedParams params);
1073 void ColorPicked(
1074 ColorPickedParams params);
1075 void InterstitialShown(
1076 InterstitialShownParams params);
1077 void InterstitialHidden(
1078 InterstitialHiddenParams params);
1079 };
1080 } // namespace page
1081
1082 namespace network {
1083 class NetworkHandler;
1084 } // namespace domain
1085
1086 namespace dom {
1087 typedef int NodeId;
1088 } // namespace dom
1089
1090 namespace dom {
1091 class DOMHandler;
1092 } // namespace domain
1093
1094 namespace worker {
1095 template<int MASK>
1096 struct DisconnectedFromWorkerParamsBuilder {
1097 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(DisconnectedFromWorkerParamsBu ilder)
1098 public:
1099 enum {
1100 kAllSet = 0,
1101 kNoneSet = kAllSet
1102 };
1103
1104
1105 static DisconnectedFromWorkerParamsBuilder<kNoneSet> Create() {
1106 return DisconnectedFromWorkerParamsBuilder<kNoneSet>();
1107 }
1108
1109 static scoped_ptr<base::DictionaryValue> ToValue(
1110 DisconnectedFromWorkerParamsBuilder src) {
1111 return src.dict_.Pass();
1112 }
1113
1114 DisconnectedFromWorkerParamsBuilder(DisconnectedFromWorkerParamsBuilder&& othe r)
1115 : dict_(other.dict_.Pass()) {
1116 }
1117
1118 private:
1119 friend struct DisconnectedFromWorkerParamsBuilder<0>;
1120
1121 DisconnectedFromWorkerParamsBuilder() : dict_(new base::DictionaryValue()) {
1122 }
1123
1124 template<class T> T& ThisAs() {
1125 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1126 return *reinterpret_cast<T*>(this);
1127 }
1128
1129 scoped_ptr<base::DictionaryValue> dict_;
1130 };
1131
1132 typedef DisconnectedFromWorkerParamsBuilder<0> DisconnectedFromWorkerParams;
1133
1134 } // namespace worker
1135
1136 namespace worker {
1137 class WorkerHandler;
1138 } // namespace domain
1139
1140 namespace worker {
1141 class Client : public DevToolsProtocolClient {
1142 public:
1143 Client(const RawMessageCallback& raw_message_callback);
1144 virtual ~Client();
1145
1146 void DisconnectedFromWorker(
1147 DisconnectedFromWorkerParams params);
1148 };
1149 } // namespace worker
1150
1151 namespace input {
1152 namespace emulate_touch_from_mouse_event {
1153 extern const char kTypeMousePressed[];
1154 extern const char kTypeMouseReleased[];
1155 extern const char kTypeMouseMoved[];
1156 extern const char kTypeMouseWheel[];
1157 } // namespace emulate_touch_from_mouse_event
1158 } // namespace input
1159
1160 namespace input {
1161 namespace emulate_touch_from_mouse_event {
1162 extern const char kButtonNone[];
1163 extern const char kButtonLeft[];
1164 extern const char kButtonMiddle[];
1165 extern const char kButtonRight[];
1166 } // namespace emulate_touch_from_mouse_event
1167 } // namespace input
1168
1169 namespace input {
1170 class InputHandler;
1171 } // namespace domain
1172
1173 namespace tracing {
1174 template<int MASK>
1175 struct StartResponseBuilder {
1176 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(StartResponseBuilder)
1177 public:
1178 enum {
1179 kAllSet = 0,
1180 kNoneSet = kAllSet
1181 };
1182
1183
1184 static StartResponseBuilder<kNoneSet> Create() {
1185 return StartResponseBuilder<kNoneSet>();
1186 }
1187
1188 static scoped_ptr<base::DictionaryValue> ToValue(
1189 StartResponseBuilder src) {
1190 return src.dict_.Pass();
1191 }
1192
1193 StartResponseBuilder(StartResponseBuilder&& other)
1194 : dict_(other.dict_.Pass()) {
1195 }
1196
1197 private:
1198 friend struct StartResponseBuilder<0>;
1199
1200 StartResponseBuilder() : dict_(new base::DictionaryValue()) {
1201 }
1202
1203 template<class T> T& ThisAs() {
1204 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1205 return *reinterpret_cast<T*>(this);
1206 }
1207
1208 scoped_ptr<base::DictionaryValue> dict_;
1209 };
1210
1211 typedef StartResponseBuilder<0> StartResponse;
1212
1213 } // namespace tracing
1214
1215 namespace tracing {
1216 template<int MASK>
1217 struct EndResponseBuilder {
1218 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(EndResponseBuilder)
1219 public:
1220 enum {
1221 kAllSet = 0,
1222 kNoneSet = kAllSet
1223 };
1224
1225
1226 static EndResponseBuilder<kNoneSet> Create() {
1227 return EndResponseBuilder<kNoneSet>();
1228 }
1229
1230 static scoped_ptr<base::DictionaryValue> ToValue(
1231 EndResponseBuilder src) {
1232 return src.dict_.Pass();
1233 }
1234
1235 EndResponseBuilder(EndResponseBuilder&& other)
1236 : dict_(other.dict_.Pass()) {
1237 }
1238
1239 private:
1240 friend struct EndResponseBuilder<0>;
1241
1242 EndResponseBuilder() : dict_(new base::DictionaryValue()) {
1243 }
1244
1245 template<class T> T& ThisAs() {
1246 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1247 return *reinterpret_cast<T*>(this);
1248 }
1249
1250 scoped_ptr<base::DictionaryValue> dict_;
1251 };
1252
1253 typedef EndResponseBuilder<0> EndResponse;
1254
1255 } // namespace tracing
1256
1257 namespace tracing {
1258 template<int MASK>
1259 struct GetCategoriesResponseBuilder {
1260 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(GetCategoriesResponseBuilder)
1261 public:
1262 enum {
1263 kAllSet = 0,
1264 kCategories = 1 << 0,
1265 kNoneSet = kCategories
1266 };
1267
1268 GetCategoriesResponseBuilder<MASK & ~kCategories>&
1269 set_categories(devtools::ListBuilder<std::string> categories) {
1270 COMPILE_ASSERT(MASK & kCategories, already_set);
1271 dict_->Set("categories",
1272 devtools::ListBuilder<std::string>::ToValue(categories.Pass()).release() );
1273 return ThisAs<GetCategoriesResponseBuilder<MASK & ~kCategories>>();
1274 }
1275
1276 static GetCategoriesResponseBuilder<kNoneSet> Create() {
1277 return GetCategoriesResponseBuilder<kNoneSet>();
1278 }
1279
1280 static scoped_ptr<base::DictionaryValue> ToValue(
1281 GetCategoriesResponseBuilder src) {
1282 return src.dict_.Pass();
1283 }
1284
1285 GetCategoriesResponseBuilder(GetCategoriesResponseBuilder&& other)
1286 : dict_(other.dict_.Pass()) {
1287 }
1288
1289 private:
1290 friend struct GetCategoriesResponseBuilder<0>;
1291
1292 GetCategoriesResponseBuilder() : dict_(new base::DictionaryValue()) {
1293 }
1294
1295 template<class T> T& ThisAs() {
1296 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1297 return *reinterpret_cast<T*>(this);
1298 }
1299
1300 scoped_ptr<base::DictionaryValue> dict_;
1301 };
1302
1303 typedef GetCategoriesResponseBuilder<0> GetCategoriesResponse;
1304
1305 } // namespace tracing
1306
1307 namespace tracing {
1308 template<int MASK>
1309 struct DataCollectedParamsBuilder {
1310 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(DataCollectedParamsBuilder)
1311 public:
1312 enum {
1313 kAllSet = 0,
1314 kValue = 1 << 0,
1315 kNoneSet = kValue
1316 };
1317
1318 DataCollectedParamsBuilder<MASK & ~kValue>&
1319 set_value(devtools::ListBuilder<base::DictionaryValue> value) {
1320 COMPILE_ASSERT(MASK & kValue, already_set);
1321 dict_->Set("value",
1322 devtools::ListBuilder<base::DictionaryValue>::ToValue(value.Pass()).rele ase());
1323 return ThisAs<DataCollectedParamsBuilder<MASK & ~kValue>>();
1324 }
1325
1326 static DataCollectedParamsBuilder<kNoneSet> Create() {
1327 return DataCollectedParamsBuilder<kNoneSet>();
1328 }
1329
1330 static scoped_ptr<base::DictionaryValue> ToValue(
1331 DataCollectedParamsBuilder src) {
1332 return src.dict_.Pass();
1333 }
1334
1335 DataCollectedParamsBuilder(DataCollectedParamsBuilder&& other)
1336 : dict_(other.dict_.Pass()) {
1337 }
1338
1339 private:
1340 friend struct DataCollectedParamsBuilder<0>;
1341
1342 DataCollectedParamsBuilder() : dict_(new base::DictionaryValue()) {
1343 }
1344
1345 template<class T> T& ThisAs() {
1346 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1347 return *reinterpret_cast<T*>(this);
1348 }
1349
1350 scoped_ptr<base::DictionaryValue> dict_;
1351 };
1352
1353 typedef DataCollectedParamsBuilder<0> DataCollectedParams;
1354
1355 } // namespace tracing
1356
1357 namespace tracing {
1358 template<int MASK>
1359 struct TracingCompleteParamsBuilder {
1360 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(TracingCompleteParamsBuilder)
1361 public:
1362 enum {
1363 kAllSet = 0,
1364 kNoneSet = kAllSet
1365 };
1366
1367
1368 static TracingCompleteParamsBuilder<kNoneSet> Create() {
1369 return TracingCompleteParamsBuilder<kNoneSet>();
1370 }
1371
1372 static scoped_ptr<base::DictionaryValue> ToValue(
1373 TracingCompleteParamsBuilder src) {
1374 return src.dict_.Pass();
1375 }
1376
1377 TracingCompleteParamsBuilder(TracingCompleteParamsBuilder&& other)
1378 : dict_(other.dict_.Pass()) {
1379 }
1380
1381 private:
1382 friend struct TracingCompleteParamsBuilder<0>;
1383
1384 TracingCompleteParamsBuilder() : dict_(new base::DictionaryValue()) {
1385 }
1386
1387 template<class T> T& ThisAs() {
1388 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1389 return *reinterpret_cast<T*>(this);
1390 }
1391
1392 scoped_ptr<base::DictionaryValue> dict_;
1393 };
1394
1395 typedef TracingCompleteParamsBuilder<0> TracingCompleteParams;
1396
1397 } // namespace tracing
1398
1399 namespace tracing {
1400 template<int MASK>
1401 struct BufferUsageParamsBuilder {
1402 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(BufferUsageParamsBuilder)
1403 public:
1404 enum {
1405 kAllSet = 0,
1406 kValue = 1 << 0,
1407 kNoneSet = kValue
1408 };
1409
1410 BufferUsageParamsBuilder<MASK & ~kValue>&
1411 set_value(double value) {
1412 COMPILE_ASSERT(MASK & kValue, already_set);
1413 dict_->SetDouble("value", value);
1414 return ThisAs<BufferUsageParamsBuilder<MASK & ~kValue>>();
1415 }
1416
1417 static BufferUsageParamsBuilder<kNoneSet> Create() {
1418 return BufferUsageParamsBuilder<kNoneSet>();
1419 }
1420
1421 static scoped_ptr<base::DictionaryValue> ToValue(
1422 BufferUsageParamsBuilder src) {
1423 return src.dict_.Pass();
1424 }
1425
1426 BufferUsageParamsBuilder(BufferUsageParamsBuilder&& other)
1427 : dict_(other.dict_.Pass()) {
1428 }
1429
1430 private:
1431 friend struct BufferUsageParamsBuilder<0>;
1432
1433 BufferUsageParamsBuilder() : dict_(new base::DictionaryValue()) {
1434 }
1435
1436 template<class T> T& ThisAs() {
1437 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1438 return *reinterpret_cast<T*>(this);
1439 }
1440
1441 scoped_ptr<base::DictionaryValue> dict_;
1442 };
1443
1444 typedef BufferUsageParamsBuilder<0> BufferUsageParams;
1445
1446 } // namespace tracing
1447
1448 namespace tracing {
1449 class TracingHandler;
1450 } // namespace domain
1451
1452 namespace tracing {
1453 class Client : public DevToolsProtocolClient {
1454 public:
1455 Client(const RawMessageCallback& raw_message_callback);
1456 virtual ~Client();
1457
1458 void SendStartResponse(
1459 scoped_refptr<DevToolsProtocol::Command> command,
1460 StartResponse params);
1461 void SendEndResponse(
1462 scoped_refptr<DevToolsProtocol::Command> command,
1463 EndResponse params);
1464 void SendGetCategoriesResponse(
1465 scoped_refptr<DevToolsProtocol::Command> command,
1466 GetCategoriesResponse params);
1467 void DataCollected(
1468 DataCollectedParams params);
1469 void TracingComplete(
1470 TracingCompleteParams params);
1471 void BufferUsage(
1472 BufferUsageParams params);
1473 };
1474 } // namespace tracing
1475
1476 namespace power {
1477 namespace get_accuracy_level {
1478 extern const char kResultHigh[];
1479 extern const char kResultModerate[];
1480 extern const char kResultLow[];
1481 } // namespace get_accuracy_level
1482 } // namespace power
1483
1484 namespace power {
1485 template<int MASK>
1486 struct PowerEventBuilder {
1487 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(PowerEventBuilder)
1488 public:
1489 enum {
1490 kAllSet = 0,
1491 kType = 1 << 0,
1492 kTimestamp = 1 << 1,
1493 kValue = 1 << 2,
1494 kNoneSet = kType | kTimestamp | kValue
1495 };
1496
1497 PowerEventBuilder<MASK & ~kType>&
1498 set_type(const std::string& type) {
1499 COMPILE_ASSERT(MASK & kType, already_set);
1500 dict_->SetString("type", type);
1501 return ThisAs<PowerEventBuilder<MASK & ~kType>>();
1502 }
1503
1504 PowerEventBuilder<MASK & ~kTimestamp>&
1505 set_timestamp(double timestamp) {
1506 COMPILE_ASSERT(MASK & kTimestamp, already_set);
1507 dict_->SetDouble("timestamp", timestamp);
1508 return ThisAs<PowerEventBuilder<MASK & ~kTimestamp>>();
1509 }
1510
1511 PowerEventBuilder<MASK & ~kValue>&
1512 set_value(double value) {
1513 COMPILE_ASSERT(MASK & kValue, already_set);
1514 dict_->SetDouble("value", value);
1515 return ThisAs<PowerEventBuilder<MASK & ~kValue>>();
1516 }
1517
1518 static PowerEventBuilder<kNoneSet> Create() {
1519 return PowerEventBuilder<kNoneSet>();
1520 }
1521
1522 static scoped_ptr<base::DictionaryValue> ToValue(
1523 PowerEventBuilder src) {
1524 return src.dict_.Pass();
1525 }
1526
1527 PowerEventBuilder(PowerEventBuilder&& other)
1528 : dict_(other.dict_.Pass()) {
1529 }
1530
1531 private:
1532 friend struct PowerEventBuilder<0>;
1533
1534 PowerEventBuilder() : dict_(new base::DictionaryValue()) {
1535 }
1536
1537 template<class T> T& ThisAs() {
1538 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1539 return *reinterpret_cast<T*>(this);
1540 }
1541
1542 scoped_ptr<base::DictionaryValue> dict_;
1543 };
1544
1545 typedef PowerEventBuilder<0> PowerEvent;
1546
1547 } // namespace power
1548
1549 namespace power {
1550 template<int MASK>
1551 struct DataAvailableParamsBuilder {
1552 MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(DataAvailableParamsBuilder)
1553 public:
1554 enum {
1555 kAllSet = 0,
1556 kValue = 1 << 0,
1557 kNoneSet = kValue
1558 };
1559
1560 DataAvailableParamsBuilder<MASK & ~kValue>&
1561 set_value(devtools::ListBuilder<devtools::power::PowerEvent> value) {
1562 COMPILE_ASSERT(MASK & kValue, already_set);
1563 dict_->Set("value",
1564 devtools::ListBuilder<devtools::power::PowerEvent>::ToValue(value.Pass() ).release());
1565 return ThisAs<DataAvailableParamsBuilder<MASK & ~kValue>>();
1566 }
1567
1568 static DataAvailableParamsBuilder<kNoneSet> Create() {
1569 return DataAvailableParamsBuilder<kNoneSet>();
1570 }
1571
1572 static scoped_ptr<base::DictionaryValue> ToValue(
1573 DataAvailableParamsBuilder src) {
1574 return src.dict_.Pass();
1575 }
1576
1577 DataAvailableParamsBuilder(DataAvailableParamsBuilder&& other)
1578 : dict_(other.dict_.Pass()) {
1579 }
1580
1581 private:
1582 friend struct DataAvailableParamsBuilder<0>;
1583
1584 DataAvailableParamsBuilder() : dict_(new base::DictionaryValue()) {
1585 }
1586
1587 template<class T> T& ThisAs() {
1588 COMPILE_ASSERT(sizeof(*this) == sizeof(T), cannot_cast);
1589 return *reinterpret_cast<T*>(this);
1590 }
1591
1592 scoped_ptr<base::DictionaryValue> dict_;
1593 };
1594
1595 typedef DataAvailableParamsBuilder<0> DataAvailableParams;
1596
1597 } // namespace power
1598
1599 namespace power {
1600 class PowerHandler;
1601 } // namespace domain
1602
1603 namespace power {
1604 class Client : public DevToolsProtocolClient {
1605 public:
1606 Client(const RawMessageCallback& raw_message_callback);
1607 virtual ~Client();
1608
1609 void DataAvailable(
1610 DataAvailableParams params);
1611 };
1612 } // namespace power
1613
1614 } // namespace devtools
1615
1616 class DevToolsProtocolHandlerImpl : public DevToolsProtocol::Handler {
1617 public:
1618 typedef DevToolsProtocolClient::Response Response;
1619 typedef DevToolsProtocolClient::ResponseStatus ResponseStatus;
1620
1621 DevToolsProtocolHandlerImpl();
1622 virtual ~DevToolsProtocolHandlerImpl();
1623
1624 void SetInspectorHandler(
1625 devtools::inspector::InspectorHandler* inspector_handler);
1626 void SetPageHandler(
1627 devtools::page::PageHandler* page_handler);
1628 void SetNetworkHandler(
1629 devtools::network::NetworkHandler* network_handler);
1630 void SetDOMHandler(
1631 devtools::dom::DOMHandler* dom_handler);
1632 void SetWorkerHandler(
1633 devtools::worker::WorkerHandler* worker_handler);
1634 void SetInputHandler(
1635 devtools::input::InputHandler* input_handler);
1636 void SetTracingHandler(
1637 devtools::tracing::TracingHandler* tracing_handler);
1638 void SetPowerHandler(
1639 devtools::power::PowerHandler* power_handler);
1640
1641 private:
1642 scoped_refptr<DevToolsProtocol::Response>
1643 OnPageEnable(
1644 scoped_refptr<DevToolsProtocol::Command> command);
1645 scoped_refptr<DevToolsProtocol::Response>
1646 OnPageDisable(
1647 scoped_refptr<DevToolsProtocol::Command> command);
1648 scoped_refptr<DevToolsProtocol::Response>
1649 OnPageReload(
1650 scoped_refptr<DevToolsProtocol::Command> command);
1651 scoped_refptr<DevToolsProtocol::Response>
1652 OnPageNavigate(
1653 scoped_refptr<DevToolsProtocol::Command> command);
1654 scoped_refptr<DevToolsProtocol::Response>
1655 OnPageGetNavigationHistory(
1656 scoped_refptr<DevToolsProtocol::Command> command);
1657 scoped_refptr<DevToolsProtocol::Response>
1658 OnPageNavigateToHistoryEntry(
1659 scoped_refptr<DevToolsProtocol::Command> command);
1660 scoped_refptr<DevToolsProtocol::Response>
1661 OnPageSetGeolocationOverride(
1662 scoped_refptr<DevToolsProtocol::Command> command);
1663 scoped_refptr<DevToolsProtocol::Response>
1664 OnPageClearGeolocationOverride(
1665 scoped_refptr<DevToolsProtocol::Command> command);
1666 scoped_refptr<DevToolsProtocol::Response>
1667 OnPageSetTouchEmulationEnabled(
1668 scoped_refptr<DevToolsProtocol::Command> command);
1669 scoped_refptr<DevToolsProtocol::Response>
1670 OnPageCaptureScreenshot(
1671 scoped_refptr<DevToolsProtocol::Command> command);
1672 scoped_refptr<DevToolsProtocol::Response>
1673 OnPageCanScreencast(
1674 scoped_refptr<DevToolsProtocol::Command> command);
1675 scoped_refptr<DevToolsProtocol::Response>
1676 OnPageCanEmulate(
1677 scoped_refptr<DevToolsProtocol::Command> command);
1678 scoped_refptr<DevToolsProtocol::Response>
1679 OnPageStartScreencast(
1680 scoped_refptr<DevToolsProtocol::Command> command);
1681 scoped_refptr<DevToolsProtocol::Response>
1682 OnPageStopScreencast(
1683 scoped_refptr<DevToolsProtocol::Command> command);
1684 scoped_refptr<DevToolsProtocol::Response>
1685 OnPageHandleJavaScriptDialog(
1686 scoped_refptr<DevToolsProtocol::Command> command);
1687 scoped_refptr<DevToolsProtocol::Response>
1688 OnPageQueryUsageAndQuota(
1689 scoped_refptr<DevToolsProtocol::Command> command);
1690 scoped_refptr<DevToolsProtocol::Response>
1691 OnPageSetColorPickerEnabled(
1692 scoped_refptr<DevToolsProtocol::Command> command);
1693 scoped_refptr<DevToolsProtocol::Response>
1694 OnNetworkClearBrowserCache(
1695 scoped_refptr<DevToolsProtocol::Command> command);
1696 scoped_refptr<DevToolsProtocol::Response>
1697 OnNetworkClearBrowserCookies(
1698 scoped_refptr<DevToolsProtocol::Command> command);
1699 scoped_refptr<DevToolsProtocol::Response>
1700 OnNetworkCanEmulateNetworkConditions(
1701 scoped_refptr<DevToolsProtocol::Command> command);
1702 scoped_refptr<DevToolsProtocol::Response>
1703 OnNetworkEmulateNetworkConditions(
1704 scoped_refptr<DevToolsProtocol::Command> command);
1705 scoped_refptr<DevToolsProtocol::Response>
1706 OnDOMSetFileInputFiles(
1707 scoped_refptr<DevToolsProtocol::Command> command);
1708 scoped_refptr<DevToolsProtocol::Response>
1709 OnWorkerDisconnectFromWorker(
1710 scoped_refptr<DevToolsProtocol::Command> command);
1711 scoped_refptr<DevToolsProtocol::Response>
1712 OnInputEmulateTouchFromMouseEvent(
1713 scoped_refptr<DevToolsProtocol::Command> command);
1714 scoped_refptr<DevToolsProtocol::Response>
1715 OnTracingStart(
1716 scoped_refptr<DevToolsProtocol::Command> command);
1717 scoped_refptr<DevToolsProtocol::Response>
1718 OnTracingEnd(
1719 scoped_refptr<DevToolsProtocol::Command> command);
1720 scoped_refptr<DevToolsProtocol::Response>
1721 OnTracingGetCategories(
1722 scoped_refptr<DevToolsProtocol::Command> command);
1723 scoped_refptr<DevToolsProtocol::Response>
1724 OnPowerStart(
1725 scoped_refptr<DevToolsProtocol::Command> command);
1726 scoped_refptr<DevToolsProtocol::Response>
1727 OnPowerEnd(
1728 scoped_refptr<DevToolsProtocol::Command> command);
1729 scoped_refptr<DevToolsProtocol::Response>
1730 OnPowerCanProfilePower(
1731 scoped_refptr<DevToolsProtocol::Command> command);
1732 scoped_refptr<DevToolsProtocol::Response>
1733 OnPowerGetAccuracyLevel(
1734 scoped_refptr<DevToolsProtocol::Command> command);
1735
1736 devtools::inspector::InspectorHandler* inspector_handler_;
1737 devtools::page::PageHandler* page_handler_;
1738 devtools::network::NetworkHandler* network_handler_;
1739 devtools::dom::DOMHandler* dom_handler_;
1740 devtools::worker::WorkerHandler* worker_handler_;
1741 devtools::input::InputHandler* input_handler_;
1742 devtools::tracing::TracingHandler* tracing_handler_;
1743 devtools::power::PowerHandler* power_handler_;
1744 };
1745
1746 } // namespace content
1747
1748 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/devtools/protocol/devtools_protocol_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698