OLD | NEW |
(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 #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" |
| 11 |
| 12 #include "base/bind.h" |
| 13 #include "content/browser/devtools/protocol/dom_handler.h" |
| 14 #include "content/browser/devtools/protocol/input_handler.h" |
| 15 #include "content/browser/devtools/protocol/inspector_handler.h" |
| 16 #include "content/browser/devtools/protocol/network_handler.h" |
| 17 #include "content/browser/devtools/protocol/page_handler.h" |
| 18 #include "content/browser/devtools/protocol/power_handler.h" |
| 19 #include "content/browser/devtools/protocol/tracing_handler.h" |
| 20 #include "content/browser/devtools/protocol/worker_handler.h" |
| 21 |
| 22 namespace content { |
| 23 |
| 24 DevToolsProtocolHandlerImpl::DevToolsProtocolHandlerImpl() |
| 25 : inspector_handler_(nullptr), |
| 26 page_handler_(nullptr), |
| 27 network_handler_(nullptr), |
| 28 dom_handler_(nullptr), |
| 29 worker_handler_(nullptr), |
| 30 input_handler_(nullptr), |
| 31 tracing_handler_(nullptr), |
| 32 power_handler_(nullptr) { |
| 33 } |
| 34 |
| 35 DevToolsProtocolHandlerImpl::~DevToolsProtocolHandlerImpl() { |
| 36 } |
| 37 |
| 38 namespace { |
| 39 |
| 40 typedef DevToolsProtocolClient::ResponseStatus ResponseStatus; |
| 41 |
| 42 bool CreateCommonResponse( |
| 43 scoped_refptr<DevToolsProtocol::Command> command, |
| 44 const DevToolsProtocolClient::Response& response, |
| 45 scoped_refptr<DevToolsProtocol::Response>* protocol_response) { |
| 46 switch (response.status()) { |
| 47 case ResponseStatus::RESPONSE_STATUS_FALLTHROUGH: |
| 48 *protocol_response = nullptr; |
| 49 break; |
| 50 case ResponseStatus::RESPONSE_STATUS_OK: |
| 51 return false; |
| 52 case ResponseStatus::RESPONSE_STATUS_INVALID_PARAMS: |
| 53 *protocol_response = command->InvalidParamResponse(response.message()); |
| 54 break; |
| 55 case ResponseStatus::RESPONSE_STATUS_INTERNAL_ERROR: |
| 56 *protocol_response = command->InternalErrorResponse(response.message()); |
| 57 break; |
| 58 case ResponseStatus::RESPONSE_STATUS_SERVER_ERROR: |
| 59 *protocol_response = command->ServerErrorResponse(response.message()); |
| 60 break; |
| 61 } |
| 62 return true; |
| 63 } |
| 64 |
| 65 } // namespace |
| 66 |
| 67 void DevToolsProtocolHandlerImpl::SetInspectorHandler( |
| 68 devtools::inspector::InspectorHandler* inspector_handler) { |
| 69 DCHECK(!inspector_handler_); |
| 70 inspector_handler_ = inspector_handler; |
| 71 inspector_handler_->SetClient(make_scoped_ptr( |
| 72 new devtools::inspector::Client( |
| 73 base::Bind(&DevToolsProtocolHandlerImpl::SendRawMessage, |
| 74 base::Unretained(this))))); |
| 75 } |
| 76 |
| 77 scoped_refptr<DevToolsProtocol::Response> |
| 78 DevToolsProtocolHandlerImpl::OnPageEnable( |
| 79 scoped_refptr<DevToolsProtocol::Command> command) { |
| 80 Response response = page_handler_->Enable(); |
| 81 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 82 if (CreateCommonResponse(command, response, &protocol_response)) |
| 83 return protocol_response; |
| 84 base::DictionaryValue* result = new base::DictionaryValue(); |
| 85 return command->SuccessResponse(result); |
| 86 } |
| 87 |
| 88 scoped_refptr<DevToolsProtocol::Response> |
| 89 DevToolsProtocolHandlerImpl::OnPageDisable( |
| 90 scoped_refptr<DevToolsProtocol::Command> command) { |
| 91 Response response = page_handler_->Disable(); |
| 92 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 93 if (CreateCommonResponse(command, response, &protocol_response)) |
| 94 return protocol_response; |
| 95 base::DictionaryValue* result = new base::DictionaryValue(); |
| 96 return command->SuccessResponse(result); |
| 97 } |
| 98 |
| 99 scoped_refptr<DevToolsProtocol::Response> |
| 100 DevToolsProtocolHandlerImpl::OnPageReload( |
| 101 scoped_refptr<DevToolsProtocol::Command> command) { |
| 102 base::DictionaryValue* params = command->params(); |
| 103 bool in_ignore_cache = false; |
| 104 bool ignore_cache_found = params && params->GetBoolean( |
| 105 "ignoreCache", |
| 106 &in_ignore_cache); |
| 107 std::string in_script_to_evaluate_on_load; |
| 108 bool script_to_evaluate_on_load_found = params && params->GetString( |
| 109 "scriptToEvaluateOnLoad", |
| 110 &in_script_to_evaluate_on_load); |
| 111 std::string in_script_preprocessor; |
| 112 bool script_preprocessor_found = params && params->GetString( |
| 113 "scriptPreprocessor", |
| 114 &in_script_preprocessor); |
| 115 Response response = page_handler_->Reload( |
| 116 ignore_cache_found ? &in_ignore_cache : nullptr, |
| 117 script_to_evaluate_on_load_found ? &in_script_to_evaluate_on_load : nullpt
r, |
| 118 script_preprocessor_found ? &in_script_preprocessor : nullptr); |
| 119 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 120 if (CreateCommonResponse(command, response, &protocol_response)) |
| 121 return protocol_response; |
| 122 base::DictionaryValue* result = new base::DictionaryValue(); |
| 123 return command->SuccessResponse(result); |
| 124 } |
| 125 |
| 126 scoped_refptr<DevToolsProtocol::Response> |
| 127 DevToolsProtocolHandlerImpl::OnPageNavigate( |
| 128 scoped_refptr<DevToolsProtocol::Command> command) { |
| 129 base::DictionaryValue* params = command->params(); |
| 130 std::string in_url; |
| 131 if (!params || !params->GetString("url", &in_url)) |
| 132 return command->InvalidParamResponse("url"); |
| 133 devtools::page::FrameId out_frame_id; |
| 134 Response response = page_handler_->Navigate( |
| 135 in_url, |
| 136 &out_frame_id); |
| 137 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 138 if (CreateCommonResponse(command, response, &protocol_response)) |
| 139 return protocol_response; |
| 140 base::DictionaryValue* result = new base::DictionaryValue(); |
| 141 result->SetString("frameId", out_frame_id); |
| 142 return command->SuccessResponse(result); |
| 143 } |
| 144 |
| 145 scoped_refptr<DevToolsProtocol::Response> |
| 146 DevToolsProtocolHandlerImpl::OnPageGetNavigationHistory( |
| 147 scoped_refptr<DevToolsProtocol::Command> command) { |
| 148 int out_current_index = 0; |
| 149 devtools::ListBuilder<devtools::page::NavigationEntry> out_entries; |
| 150 Response response = page_handler_->GetNavigationHistory( |
| 151 &out_current_index, |
| 152 &out_entries); |
| 153 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 154 if (CreateCommonResponse(command, response, &protocol_response)) |
| 155 return protocol_response; |
| 156 base::DictionaryValue* result = new base::DictionaryValue(); |
| 157 result->SetInteger("currentIndex", out_current_index); |
| 158 result->Set("entries", |
| 159 devtools::ListBuilder<devtools::page::NavigationEntry>::ToValue(out_entrie
s.Pass()).release()); |
| 160 return command->SuccessResponse(result); |
| 161 } |
| 162 |
| 163 scoped_refptr<DevToolsProtocol::Response> |
| 164 DevToolsProtocolHandlerImpl::OnPageNavigateToHistoryEntry( |
| 165 scoped_refptr<DevToolsProtocol::Command> command) { |
| 166 base::DictionaryValue* params = command->params(); |
| 167 int in_entry_id = 0; |
| 168 if (!params || !params->GetInteger("entryId", &in_entry_id)) |
| 169 return command->InvalidParamResponse("entryId"); |
| 170 Response response = page_handler_->NavigateToHistoryEntry( |
| 171 in_entry_id); |
| 172 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 173 if (CreateCommonResponse(command, response, &protocol_response)) |
| 174 return protocol_response; |
| 175 base::DictionaryValue* result = new base::DictionaryValue(); |
| 176 return command->SuccessResponse(result); |
| 177 } |
| 178 |
| 179 scoped_refptr<DevToolsProtocol::Response> |
| 180 DevToolsProtocolHandlerImpl::OnPageSetGeolocationOverride( |
| 181 scoped_refptr<DevToolsProtocol::Command> command) { |
| 182 base::DictionaryValue* params = command->params(); |
| 183 double in_latitude = 0.0; |
| 184 bool latitude_found = params && params->GetDouble( |
| 185 "latitude", |
| 186 &in_latitude); |
| 187 double in_longitude = 0.0; |
| 188 bool longitude_found = params && params->GetDouble( |
| 189 "longitude", |
| 190 &in_longitude); |
| 191 double in_accuracy = 0.0; |
| 192 bool accuracy_found = params && params->GetDouble( |
| 193 "accuracy", |
| 194 &in_accuracy); |
| 195 Response response = page_handler_->SetGeolocationOverride( |
| 196 latitude_found ? &in_latitude : nullptr, |
| 197 longitude_found ? &in_longitude : nullptr, |
| 198 accuracy_found ? &in_accuracy : nullptr); |
| 199 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 200 if (CreateCommonResponse(command, response, &protocol_response)) |
| 201 return protocol_response; |
| 202 base::DictionaryValue* result = new base::DictionaryValue(); |
| 203 return command->SuccessResponse(result); |
| 204 } |
| 205 |
| 206 scoped_refptr<DevToolsProtocol::Response> |
| 207 DevToolsProtocolHandlerImpl::OnPageClearGeolocationOverride( |
| 208 scoped_refptr<DevToolsProtocol::Command> command) { |
| 209 Response response = page_handler_->ClearGeolocationOverride(); |
| 210 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 211 if (CreateCommonResponse(command, response, &protocol_response)) |
| 212 return protocol_response; |
| 213 base::DictionaryValue* result = new base::DictionaryValue(); |
| 214 return command->SuccessResponse(result); |
| 215 } |
| 216 |
| 217 scoped_refptr<DevToolsProtocol::Response> |
| 218 DevToolsProtocolHandlerImpl::OnPageSetTouchEmulationEnabled( |
| 219 scoped_refptr<DevToolsProtocol::Command> command) { |
| 220 base::DictionaryValue* params = command->params(); |
| 221 bool in_enabled = false; |
| 222 if (!params || !params->GetBoolean("enabled", &in_enabled)) |
| 223 return command->InvalidParamResponse("enabled"); |
| 224 Response response = page_handler_->SetTouchEmulationEnabled( |
| 225 in_enabled); |
| 226 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 227 if (CreateCommonResponse(command, response, &protocol_response)) |
| 228 return protocol_response; |
| 229 base::DictionaryValue* result = new base::DictionaryValue(); |
| 230 return command->SuccessResponse(result); |
| 231 } |
| 232 |
| 233 scoped_refptr<DevToolsProtocol::Response> |
| 234 DevToolsProtocolHandlerImpl::OnPageCaptureScreenshot( |
| 235 scoped_refptr<DevToolsProtocol::Command> command) { |
| 236 return page_handler_->CaptureScreenshot( |
| 237 command); |
| 238 } |
| 239 |
| 240 scoped_refptr<DevToolsProtocol::Response> |
| 241 DevToolsProtocolHandlerImpl::OnPageCanScreencast( |
| 242 scoped_refptr<DevToolsProtocol::Command> command) { |
| 243 bool out_result = false; |
| 244 Response response = page_handler_->CanScreencast( |
| 245 &out_result); |
| 246 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 247 if (CreateCommonResponse(command, response, &protocol_response)) |
| 248 return protocol_response; |
| 249 base::DictionaryValue* result = new base::DictionaryValue(); |
| 250 result->SetBoolean("result", out_result); |
| 251 return command->SuccessResponse(result); |
| 252 } |
| 253 |
| 254 scoped_refptr<DevToolsProtocol::Response> |
| 255 DevToolsProtocolHandlerImpl::OnPageCanEmulate( |
| 256 scoped_refptr<DevToolsProtocol::Command> command) { |
| 257 bool out_result = false; |
| 258 Response response = page_handler_->CanEmulate( |
| 259 &out_result); |
| 260 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 261 if (CreateCommonResponse(command, response, &protocol_response)) |
| 262 return protocol_response; |
| 263 base::DictionaryValue* result = new base::DictionaryValue(); |
| 264 result->SetBoolean("result", out_result); |
| 265 return command->SuccessResponse(result); |
| 266 } |
| 267 |
| 268 scoped_refptr<DevToolsProtocol::Response> |
| 269 DevToolsProtocolHandlerImpl::OnPageStartScreencast( |
| 270 scoped_refptr<DevToolsProtocol::Command> command) { |
| 271 base::DictionaryValue* params = command->params(); |
| 272 std::string in_format; |
| 273 bool format_found = params && params->GetString( |
| 274 "format", |
| 275 &in_format); |
| 276 int in_quality = 0; |
| 277 bool quality_found = params && params->GetInteger( |
| 278 "quality", |
| 279 &in_quality); |
| 280 int in_max_width = 0; |
| 281 bool max_width_found = params && params->GetInteger( |
| 282 "maxWidth", |
| 283 &in_max_width); |
| 284 int in_max_height = 0; |
| 285 bool max_height_found = params && params->GetInteger( |
| 286 "maxHeight", |
| 287 &in_max_height); |
| 288 Response response = page_handler_->StartScreencast( |
| 289 format_found ? &in_format : nullptr, |
| 290 quality_found ? &in_quality : nullptr, |
| 291 max_width_found ? &in_max_width : nullptr, |
| 292 max_height_found ? &in_max_height : nullptr); |
| 293 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 294 if (CreateCommonResponse(command, response, &protocol_response)) |
| 295 return protocol_response; |
| 296 base::DictionaryValue* result = new base::DictionaryValue(); |
| 297 return command->SuccessResponse(result); |
| 298 } |
| 299 |
| 300 scoped_refptr<DevToolsProtocol::Response> |
| 301 DevToolsProtocolHandlerImpl::OnPageStopScreencast( |
| 302 scoped_refptr<DevToolsProtocol::Command> command) { |
| 303 Response response = page_handler_->StopScreencast(); |
| 304 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 305 if (CreateCommonResponse(command, response, &protocol_response)) |
| 306 return protocol_response; |
| 307 base::DictionaryValue* result = new base::DictionaryValue(); |
| 308 return command->SuccessResponse(result); |
| 309 } |
| 310 |
| 311 scoped_refptr<DevToolsProtocol::Response> |
| 312 DevToolsProtocolHandlerImpl::OnPageHandleJavaScriptDialog( |
| 313 scoped_refptr<DevToolsProtocol::Command> command) { |
| 314 base::DictionaryValue* params = command->params(); |
| 315 bool in_accept = false; |
| 316 if (!params || !params->GetBoolean("accept", &in_accept)) |
| 317 return command->InvalidParamResponse("accept"); |
| 318 std::string in_prompt_text; |
| 319 bool prompt_text_found = params && params->GetString( |
| 320 "promptText", |
| 321 &in_prompt_text); |
| 322 Response response = page_handler_->HandleJavaScriptDialog( |
| 323 in_accept, |
| 324 prompt_text_found ? &in_prompt_text : nullptr); |
| 325 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 326 if (CreateCommonResponse(command, response, &protocol_response)) |
| 327 return protocol_response; |
| 328 base::DictionaryValue* result = new base::DictionaryValue(); |
| 329 return command->SuccessResponse(result); |
| 330 } |
| 331 |
| 332 scoped_refptr<DevToolsProtocol::Response> |
| 333 DevToolsProtocolHandlerImpl::OnPageQueryUsageAndQuota( |
| 334 scoped_refptr<DevToolsProtocol::Command> command) { |
| 335 base::DictionaryValue* params = command->params(); |
| 336 std::string in_security_origin; |
| 337 if (!params || !params->GetString("securityOrigin", &in_security_origin)) |
| 338 return command->InvalidParamResponse("securityOrigin"); |
| 339 return page_handler_->QueryUsageAndQuota( |
| 340 in_security_origin, |
| 341 command); |
| 342 } |
| 343 |
| 344 scoped_refptr<DevToolsProtocol::Response> |
| 345 DevToolsProtocolHandlerImpl::OnPageSetColorPickerEnabled( |
| 346 scoped_refptr<DevToolsProtocol::Command> command) { |
| 347 base::DictionaryValue* params = command->params(); |
| 348 bool in_enabled = false; |
| 349 if (!params || !params->GetBoolean("enabled", &in_enabled)) |
| 350 return command->InvalidParamResponse("enabled"); |
| 351 Response response = page_handler_->SetColorPickerEnabled( |
| 352 in_enabled); |
| 353 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 354 if (CreateCommonResponse(command, response, &protocol_response)) |
| 355 return protocol_response; |
| 356 base::DictionaryValue* result = new base::DictionaryValue(); |
| 357 return command->SuccessResponse(result); |
| 358 } |
| 359 |
| 360 void DevToolsProtocolHandlerImpl::SetPageHandler( |
| 361 devtools::page::PageHandler* page_handler) { |
| 362 DCHECK(!page_handler_); |
| 363 page_handler_ = page_handler; |
| 364 RegisterCommandHandler( |
| 365 "Page.enable", |
| 366 base::Bind( |
| 367 &DevToolsProtocolHandlerImpl::OnPageEnable, |
| 368 base::Unretained(this))); |
| 369 RegisterCommandHandler( |
| 370 "Page.disable", |
| 371 base::Bind( |
| 372 &DevToolsProtocolHandlerImpl::OnPageDisable, |
| 373 base::Unretained(this))); |
| 374 RegisterCommandHandler( |
| 375 "Page.reload", |
| 376 base::Bind( |
| 377 &DevToolsProtocolHandlerImpl::OnPageReload, |
| 378 base::Unretained(this))); |
| 379 RegisterCommandHandler( |
| 380 "Page.navigate", |
| 381 base::Bind( |
| 382 &DevToolsProtocolHandlerImpl::OnPageNavigate, |
| 383 base::Unretained(this))); |
| 384 RegisterCommandHandler( |
| 385 "Page.getNavigationHistory", |
| 386 base::Bind( |
| 387 &DevToolsProtocolHandlerImpl::OnPageGetNavigationHistory, |
| 388 base::Unretained(this))); |
| 389 RegisterCommandHandler( |
| 390 "Page.navigateToHistoryEntry", |
| 391 base::Bind( |
| 392 &DevToolsProtocolHandlerImpl::OnPageNavigateToHistoryEntry, |
| 393 base::Unretained(this))); |
| 394 RegisterCommandHandler( |
| 395 "Page.setGeolocationOverride", |
| 396 base::Bind( |
| 397 &DevToolsProtocolHandlerImpl::OnPageSetGeolocationOverride, |
| 398 base::Unretained(this))); |
| 399 RegisterCommandHandler( |
| 400 "Page.clearGeolocationOverride", |
| 401 base::Bind( |
| 402 &DevToolsProtocolHandlerImpl::OnPageClearGeolocationOverride, |
| 403 base::Unretained(this))); |
| 404 RegisterCommandHandler( |
| 405 "Page.setTouchEmulationEnabled", |
| 406 base::Bind( |
| 407 &DevToolsProtocolHandlerImpl::OnPageSetTouchEmulationEnabled, |
| 408 base::Unretained(this))); |
| 409 RegisterCommandHandler( |
| 410 "Page.captureScreenshot", |
| 411 base::Bind( |
| 412 &DevToolsProtocolHandlerImpl::OnPageCaptureScreenshot, |
| 413 base::Unretained(this))); |
| 414 RegisterCommandHandler( |
| 415 "Page.canScreencast", |
| 416 base::Bind( |
| 417 &DevToolsProtocolHandlerImpl::OnPageCanScreencast, |
| 418 base::Unretained(this))); |
| 419 RegisterCommandHandler( |
| 420 "Page.canEmulate", |
| 421 base::Bind( |
| 422 &DevToolsProtocolHandlerImpl::OnPageCanEmulate, |
| 423 base::Unretained(this))); |
| 424 RegisterCommandHandler( |
| 425 "Page.startScreencast", |
| 426 base::Bind( |
| 427 &DevToolsProtocolHandlerImpl::OnPageStartScreencast, |
| 428 base::Unretained(this))); |
| 429 RegisterCommandHandler( |
| 430 "Page.stopScreencast", |
| 431 base::Bind( |
| 432 &DevToolsProtocolHandlerImpl::OnPageStopScreencast, |
| 433 base::Unretained(this))); |
| 434 RegisterCommandHandler( |
| 435 "Page.handleJavaScriptDialog", |
| 436 base::Bind( |
| 437 &DevToolsProtocolHandlerImpl::OnPageHandleJavaScriptDialog, |
| 438 base::Unretained(this))); |
| 439 RegisterCommandHandler( |
| 440 "Page.queryUsageAndQuota", |
| 441 base::Bind( |
| 442 &DevToolsProtocolHandlerImpl::OnPageQueryUsageAndQuota, |
| 443 base::Unretained(this))); |
| 444 RegisterCommandHandler( |
| 445 "Page.setColorPickerEnabled", |
| 446 base::Bind( |
| 447 &DevToolsProtocolHandlerImpl::OnPageSetColorPickerEnabled, |
| 448 base::Unretained(this))); |
| 449 page_handler_->SetClient(make_scoped_ptr( |
| 450 new devtools::page::Client( |
| 451 base::Bind(&DevToolsProtocolHandlerImpl::SendRawMessage, |
| 452 base::Unretained(this))))); |
| 453 } |
| 454 |
| 455 scoped_refptr<DevToolsProtocol::Response> |
| 456 DevToolsProtocolHandlerImpl::OnNetworkClearBrowserCache( |
| 457 scoped_refptr<DevToolsProtocol::Command> command) { |
| 458 Response response = network_handler_->ClearBrowserCache(); |
| 459 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 460 if (CreateCommonResponse(command, response, &protocol_response)) |
| 461 return protocol_response; |
| 462 base::DictionaryValue* result = new base::DictionaryValue(); |
| 463 return command->SuccessResponse(result); |
| 464 } |
| 465 |
| 466 scoped_refptr<DevToolsProtocol::Response> |
| 467 DevToolsProtocolHandlerImpl::OnNetworkClearBrowserCookies( |
| 468 scoped_refptr<DevToolsProtocol::Command> command) { |
| 469 Response response = network_handler_->ClearBrowserCookies(); |
| 470 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 471 if (CreateCommonResponse(command, response, &protocol_response)) |
| 472 return protocol_response; |
| 473 base::DictionaryValue* result = new base::DictionaryValue(); |
| 474 return command->SuccessResponse(result); |
| 475 } |
| 476 |
| 477 scoped_refptr<DevToolsProtocol::Response> |
| 478 DevToolsProtocolHandlerImpl::OnNetworkCanEmulateNetworkConditions( |
| 479 scoped_refptr<DevToolsProtocol::Command> command) { |
| 480 bool out_result = false; |
| 481 Response response = network_handler_->CanEmulateNetworkConditions( |
| 482 &out_result); |
| 483 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 484 if (CreateCommonResponse(command, response, &protocol_response)) |
| 485 return protocol_response; |
| 486 base::DictionaryValue* result = new base::DictionaryValue(); |
| 487 result->SetBoolean("result", out_result); |
| 488 return command->SuccessResponse(result); |
| 489 } |
| 490 |
| 491 scoped_refptr<DevToolsProtocol::Response> |
| 492 DevToolsProtocolHandlerImpl::OnNetworkEmulateNetworkConditions( |
| 493 scoped_refptr<DevToolsProtocol::Command> command) { |
| 494 base::DictionaryValue* params = command->params(); |
| 495 bool in_offline = false; |
| 496 if (!params || !params->GetBoolean("offline", &in_offline)) |
| 497 return command->InvalidParamResponse("offline"); |
| 498 double in_latency = 0.0; |
| 499 if (!params || !params->GetDouble("latency", &in_latency)) |
| 500 return command->InvalidParamResponse("latency"); |
| 501 double in_download_throughput = 0.0; |
| 502 if (!params || !params->GetDouble("downloadThroughput", &in_download_throughpu
t)) |
| 503 return command->InvalidParamResponse("downloadThroughput"); |
| 504 double in_upload_throughput = 0.0; |
| 505 if (!params || !params->GetDouble("uploadThroughput", &in_upload_throughput)) |
| 506 return command->InvalidParamResponse("uploadThroughput"); |
| 507 Response response = network_handler_->EmulateNetworkConditions( |
| 508 in_offline, |
| 509 in_latency, |
| 510 in_download_throughput, |
| 511 in_upload_throughput); |
| 512 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 513 if (CreateCommonResponse(command, response, &protocol_response)) |
| 514 return protocol_response; |
| 515 base::DictionaryValue* result = new base::DictionaryValue(); |
| 516 return command->SuccessResponse(result); |
| 517 } |
| 518 |
| 519 void DevToolsProtocolHandlerImpl::SetNetworkHandler( |
| 520 devtools::network::NetworkHandler* network_handler) { |
| 521 DCHECK(!network_handler_); |
| 522 network_handler_ = network_handler; |
| 523 RegisterCommandHandler( |
| 524 "Network.clearBrowserCache", |
| 525 base::Bind( |
| 526 &DevToolsProtocolHandlerImpl::OnNetworkClearBrowserCache, |
| 527 base::Unretained(this))); |
| 528 RegisterCommandHandler( |
| 529 "Network.clearBrowserCookies", |
| 530 base::Bind( |
| 531 &DevToolsProtocolHandlerImpl::OnNetworkClearBrowserCookies, |
| 532 base::Unretained(this))); |
| 533 RegisterCommandHandler( |
| 534 "Network.canEmulateNetworkConditions", |
| 535 base::Bind( |
| 536 &DevToolsProtocolHandlerImpl::OnNetworkCanEmulateNetworkConditions, |
| 537 base::Unretained(this))); |
| 538 RegisterCommandHandler( |
| 539 "Network.emulateNetworkConditions", |
| 540 base::Bind( |
| 541 &DevToolsProtocolHandlerImpl::OnNetworkEmulateNetworkConditions, |
| 542 base::Unretained(this))); |
| 543 } |
| 544 |
| 545 scoped_refptr<DevToolsProtocol::Response> |
| 546 DevToolsProtocolHandlerImpl::OnDOMSetFileInputFiles( |
| 547 scoped_refptr<DevToolsProtocol::Command> command) { |
| 548 base::DictionaryValue* params = command->params(); |
| 549 int in_node_id = 0; |
| 550 if (!params || !params->GetInteger("nodeId", &in_node_id)) |
| 551 return command->InvalidParamResponse("nodeId"); |
| 552 base::ListValue* list_files = nullptr; |
| 553 if (!params || !params->GetList("files", &list_files)) |
| 554 return command->InvalidParamResponse("files"); |
| 555 std::vector<std::string> in_files; |
| 556 for (base::ListValue::const_iterator it = |
| 557 list_files->begin(); it != list_files->end(); ++it) { |
| 558 std::string item; |
| 559 if (!(*it)->GetAsString(&item)) |
| 560 return command->InvalidParamResponse("files"); |
| 561 in_files.push_back(item); |
| 562 } |
| 563 Response response = dom_handler_->SetFileInputFiles( |
| 564 in_node_id, |
| 565 in_files); |
| 566 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 567 if (CreateCommonResponse(command, response, &protocol_response)) |
| 568 return protocol_response; |
| 569 base::DictionaryValue* result = new base::DictionaryValue(); |
| 570 return command->SuccessResponse(result); |
| 571 } |
| 572 |
| 573 void DevToolsProtocolHandlerImpl::SetDOMHandler( |
| 574 devtools::dom::DOMHandler* dom_handler) { |
| 575 DCHECK(!dom_handler_); |
| 576 dom_handler_ = dom_handler; |
| 577 RegisterCommandHandler( |
| 578 "DOM.setFileInputFiles", |
| 579 base::Bind( |
| 580 &DevToolsProtocolHandlerImpl::OnDOMSetFileInputFiles, |
| 581 base::Unretained(this))); |
| 582 } |
| 583 |
| 584 scoped_refptr<DevToolsProtocol::Response> |
| 585 DevToolsProtocolHandlerImpl::OnWorkerDisconnectFromWorker( |
| 586 scoped_refptr<DevToolsProtocol::Command> command) { |
| 587 base::DictionaryValue* params = command->params(); |
| 588 int in_worker_id = 0; |
| 589 if (!params || !params->GetInteger("workerId", &in_worker_id)) |
| 590 return command->InvalidParamResponse("workerId"); |
| 591 Response response = worker_handler_->DisconnectFromWorker( |
| 592 in_worker_id); |
| 593 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 594 if (CreateCommonResponse(command, response, &protocol_response)) |
| 595 return protocol_response; |
| 596 base::DictionaryValue* result = new base::DictionaryValue(); |
| 597 return command->SuccessResponse(result); |
| 598 } |
| 599 |
| 600 void DevToolsProtocolHandlerImpl::SetWorkerHandler( |
| 601 devtools::worker::WorkerHandler* worker_handler) { |
| 602 DCHECK(!worker_handler_); |
| 603 worker_handler_ = worker_handler; |
| 604 RegisterCommandHandler( |
| 605 "Worker.disconnectFromWorker", |
| 606 base::Bind( |
| 607 &DevToolsProtocolHandlerImpl::OnWorkerDisconnectFromWorker, |
| 608 base::Unretained(this))); |
| 609 worker_handler_->SetClient(make_scoped_ptr( |
| 610 new devtools::worker::Client( |
| 611 base::Bind(&DevToolsProtocolHandlerImpl::SendRawMessage, |
| 612 base::Unretained(this))))); |
| 613 } |
| 614 |
| 615 scoped_refptr<DevToolsProtocol::Response> |
| 616 DevToolsProtocolHandlerImpl::OnInputEmulateTouchFromMouseEvent( |
| 617 scoped_refptr<DevToolsProtocol::Command> command) { |
| 618 base::DictionaryValue* params = command->params(); |
| 619 std::string in_type; |
| 620 if (!params || !params->GetString("type", &in_type)) |
| 621 return command->InvalidParamResponse("type"); |
| 622 int in_x = 0; |
| 623 if (!params || !params->GetInteger("x", &in_x)) |
| 624 return command->InvalidParamResponse("x"); |
| 625 int in_y = 0; |
| 626 if (!params || !params->GetInteger("y", &in_y)) |
| 627 return command->InvalidParamResponse("y"); |
| 628 double in_timestamp = 0.0; |
| 629 if (!params || !params->GetDouble("timestamp", &in_timestamp)) |
| 630 return command->InvalidParamResponse("timestamp"); |
| 631 std::string in_button; |
| 632 if (!params || !params->GetString("button", &in_button)) |
| 633 return command->InvalidParamResponse("button"); |
| 634 double in_delta_x = 0.0; |
| 635 bool delta_x_found = params && params->GetDouble( |
| 636 "deltaX", |
| 637 &in_delta_x); |
| 638 double in_delta_y = 0.0; |
| 639 bool delta_y_found = params && params->GetDouble( |
| 640 "deltaY", |
| 641 &in_delta_y); |
| 642 int in_modifiers = 0; |
| 643 bool modifiers_found = params && params->GetInteger( |
| 644 "modifiers", |
| 645 &in_modifiers); |
| 646 int in_click_count = 0; |
| 647 bool click_count_found = params && params->GetInteger( |
| 648 "clickCount", |
| 649 &in_click_count); |
| 650 Response response = input_handler_->EmulateTouchFromMouseEvent( |
| 651 in_type, |
| 652 in_x, |
| 653 in_y, |
| 654 in_timestamp, |
| 655 in_button, |
| 656 delta_x_found ? &in_delta_x : nullptr, |
| 657 delta_y_found ? &in_delta_y : nullptr, |
| 658 modifiers_found ? &in_modifiers : nullptr, |
| 659 click_count_found ? &in_click_count : nullptr); |
| 660 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 661 if (CreateCommonResponse(command, response, &protocol_response)) |
| 662 return protocol_response; |
| 663 base::DictionaryValue* result = new base::DictionaryValue(); |
| 664 return command->SuccessResponse(result); |
| 665 } |
| 666 |
| 667 void DevToolsProtocolHandlerImpl::SetInputHandler( |
| 668 devtools::input::InputHandler* input_handler) { |
| 669 DCHECK(!input_handler_); |
| 670 input_handler_ = input_handler; |
| 671 RegisterCommandHandler( |
| 672 "Input.emulateTouchFromMouseEvent", |
| 673 base::Bind( |
| 674 &DevToolsProtocolHandlerImpl::OnInputEmulateTouchFromMouseEvent, |
| 675 base::Unretained(this))); |
| 676 } |
| 677 |
| 678 scoped_refptr<DevToolsProtocol::Response> |
| 679 DevToolsProtocolHandlerImpl::OnTracingStart( |
| 680 scoped_refptr<DevToolsProtocol::Command> command) { |
| 681 base::DictionaryValue* params = command->params(); |
| 682 std::string in_categories; |
| 683 bool categories_found = params && params->GetString( |
| 684 "categories", |
| 685 &in_categories); |
| 686 std::string in_options; |
| 687 bool options_found = params && params->GetString( |
| 688 "options", |
| 689 &in_options); |
| 690 double in_buffer_usage_reporting_interval = 0.0; |
| 691 bool buffer_usage_reporting_interval_found = params && params->GetDouble( |
| 692 "bufferUsageReportingInterval", |
| 693 &in_buffer_usage_reporting_interval); |
| 694 return tracing_handler_->Start( |
| 695 categories_found ? &in_categories : nullptr, |
| 696 options_found ? &in_options : nullptr, |
| 697 buffer_usage_reporting_interval_found ? &in_buffer_usage_reporting_interva
l : nullptr, |
| 698 command); |
| 699 } |
| 700 |
| 701 scoped_refptr<DevToolsProtocol::Response> |
| 702 DevToolsProtocolHandlerImpl::OnTracingEnd( |
| 703 scoped_refptr<DevToolsProtocol::Command> command) { |
| 704 return tracing_handler_->End( |
| 705 command); |
| 706 } |
| 707 |
| 708 scoped_refptr<DevToolsProtocol::Response> |
| 709 DevToolsProtocolHandlerImpl::OnTracingGetCategories( |
| 710 scoped_refptr<DevToolsProtocol::Command> command) { |
| 711 return tracing_handler_->GetCategories( |
| 712 command); |
| 713 } |
| 714 |
| 715 void DevToolsProtocolHandlerImpl::SetTracingHandler( |
| 716 devtools::tracing::TracingHandler* tracing_handler) { |
| 717 DCHECK(!tracing_handler_); |
| 718 tracing_handler_ = tracing_handler; |
| 719 RegisterCommandHandler( |
| 720 "Tracing.start", |
| 721 base::Bind( |
| 722 &DevToolsProtocolHandlerImpl::OnTracingStart, |
| 723 base::Unretained(this))); |
| 724 RegisterCommandHandler( |
| 725 "Tracing.end", |
| 726 base::Bind( |
| 727 &DevToolsProtocolHandlerImpl::OnTracingEnd, |
| 728 base::Unretained(this))); |
| 729 RegisterCommandHandler( |
| 730 "Tracing.getCategories", |
| 731 base::Bind( |
| 732 &DevToolsProtocolHandlerImpl::OnTracingGetCategories, |
| 733 base::Unretained(this))); |
| 734 tracing_handler_->SetClient(make_scoped_ptr( |
| 735 new devtools::tracing::Client( |
| 736 base::Bind(&DevToolsProtocolHandlerImpl::SendRawMessage, |
| 737 base::Unretained(this))))); |
| 738 } |
| 739 |
| 740 scoped_refptr<DevToolsProtocol::Response> |
| 741 DevToolsProtocolHandlerImpl::OnPowerStart( |
| 742 scoped_refptr<DevToolsProtocol::Command> command) { |
| 743 Response response = power_handler_->Start(); |
| 744 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 745 if (CreateCommonResponse(command, response, &protocol_response)) |
| 746 return protocol_response; |
| 747 base::DictionaryValue* result = new base::DictionaryValue(); |
| 748 return command->SuccessResponse(result); |
| 749 } |
| 750 |
| 751 scoped_refptr<DevToolsProtocol::Response> |
| 752 DevToolsProtocolHandlerImpl::OnPowerEnd( |
| 753 scoped_refptr<DevToolsProtocol::Command> command) { |
| 754 Response response = power_handler_->End(); |
| 755 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 756 if (CreateCommonResponse(command, response, &protocol_response)) |
| 757 return protocol_response; |
| 758 base::DictionaryValue* result = new base::DictionaryValue(); |
| 759 return command->SuccessResponse(result); |
| 760 } |
| 761 |
| 762 scoped_refptr<DevToolsProtocol::Response> |
| 763 DevToolsProtocolHandlerImpl::OnPowerCanProfilePower( |
| 764 scoped_refptr<DevToolsProtocol::Command> command) { |
| 765 bool out_result = false; |
| 766 Response response = power_handler_->CanProfilePower( |
| 767 &out_result); |
| 768 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 769 if (CreateCommonResponse(command, response, &protocol_response)) |
| 770 return protocol_response; |
| 771 base::DictionaryValue* result = new base::DictionaryValue(); |
| 772 result->SetBoolean("result", out_result); |
| 773 return command->SuccessResponse(result); |
| 774 } |
| 775 |
| 776 scoped_refptr<DevToolsProtocol::Response> |
| 777 DevToolsProtocolHandlerImpl::OnPowerGetAccuracyLevel( |
| 778 scoped_refptr<DevToolsProtocol::Command> command) { |
| 779 std::string out_result; |
| 780 Response response = power_handler_->GetAccuracyLevel( |
| 781 &out_result); |
| 782 scoped_refptr<DevToolsProtocol::Response> protocol_response; |
| 783 if (CreateCommonResponse(command, response, &protocol_response)) |
| 784 return protocol_response; |
| 785 base::DictionaryValue* result = new base::DictionaryValue(); |
| 786 result->SetString("result", out_result); |
| 787 return command->SuccessResponse(result); |
| 788 } |
| 789 |
| 790 void DevToolsProtocolHandlerImpl::SetPowerHandler( |
| 791 devtools::power::PowerHandler* power_handler) { |
| 792 DCHECK(!power_handler_); |
| 793 power_handler_ = power_handler; |
| 794 RegisterCommandHandler( |
| 795 "Power.start", |
| 796 base::Bind( |
| 797 &DevToolsProtocolHandlerImpl::OnPowerStart, |
| 798 base::Unretained(this))); |
| 799 RegisterCommandHandler( |
| 800 "Power.end", |
| 801 base::Bind( |
| 802 &DevToolsProtocolHandlerImpl::OnPowerEnd, |
| 803 base::Unretained(this))); |
| 804 RegisterCommandHandler( |
| 805 "Power.canProfilePower", |
| 806 base::Bind( |
| 807 &DevToolsProtocolHandlerImpl::OnPowerCanProfilePower, |
| 808 base::Unretained(this))); |
| 809 RegisterCommandHandler( |
| 810 "Power.getAccuracyLevel", |
| 811 base::Bind( |
| 812 &DevToolsProtocolHandlerImpl::OnPowerGetAccuracyLevel, |
| 813 base::Unretained(this))); |
| 814 power_handler_->SetClient(make_scoped_ptr( |
| 815 new devtools::power::Client( |
| 816 base::Bind(&DevToolsProtocolHandlerImpl::SendRawMessage, |
| 817 base::Unretained(this))))); |
| 818 } |
| 819 |
| 820 namespace devtools { |
| 821 |
| 822 ListBuilderBase::ListBuilderBase() |
| 823 : list_(new base::ListValue) { |
| 824 } |
| 825 |
| 826 ListBuilderBase::ListBuilderBase(scoped_ptr<base::ListValue> list) |
| 827 : list_(list.Pass()) { |
| 828 } |
| 829 |
| 830 // static |
| 831 scoped_ptr<base::ListValue> ListBuilderBase::ToValue( |
| 832 ListBuilderBase src) { |
| 833 return src.list_.Pass(); |
| 834 } |
| 835 |
| 836 namespace inspector { |
| 837 |
| 838 Client::Client(const RawMessageCallback& raw_message_callback) |
| 839 : DevToolsProtocolClient(raw_message_callback) { |
| 840 } |
| 841 |
| 842 Client::~Client() { |
| 843 } |
| 844 |
| 845 void Client::Detached( |
| 846 DetachedParams params) { |
| 847 SendNotification("Inspector.detached", |
| 848 DetachedParams::ToValue(params.Pass()).Pass()); |
| 849 } |
| 850 |
| 851 void Client::TargetCrashed( |
| 852 TargetCrashedParams params) { |
| 853 SendNotification("Inspector.targetCrashed", |
| 854 TargetCrashedParams::ToValue(params.Pass()).Pass()); |
| 855 } |
| 856 |
| 857 } // namespace inspector |
| 858 |
| 859 namespace page { |
| 860 namespace start_screencast { |
| 861 const char kFormatJpeg[] = "jpeg"; |
| 862 const char kFormatPng[] = "png"; |
| 863 } // namespace start_screencast |
| 864 } // namespace page |
| 865 |
| 866 namespace page { |
| 867 namespace usage_item { |
| 868 const char kIdFilesystem[] = "filesystem"; |
| 869 const char kIdDatabase[] = "database"; |
| 870 const char kIdAppcache[] = "appcache"; |
| 871 const char kIdIndexeddatabase[] = "indexeddatabase"; |
| 872 } // namespace usage_item |
| 873 } // namespace page |
| 874 |
| 875 namespace page { |
| 876 |
| 877 Client::Client(const RawMessageCallback& raw_message_callback) |
| 878 : DevToolsProtocolClient(raw_message_callback) { |
| 879 } |
| 880 |
| 881 Client::~Client() { |
| 882 } |
| 883 |
| 884 void Client::SendCaptureScreenshotResponse( |
| 885 scoped_refptr<DevToolsProtocol::Command> command, |
| 886 CaptureScreenshotResponse params) { |
| 887 SendAsyncResponse( |
| 888 command->SuccessResponse( |
| 889 CaptureScreenshotResponse::ToValue(params.Pass()).release())); |
| 890 } |
| 891 |
| 892 void Client::SendQueryUsageAndQuotaResponse( |
| 893 scoped_refptr<DevToolsProtocol::Command> command, |
| 894 QueryUsageAndQuotaResponse params) { |
| 895 SendAsyncResponse( |
| 896 command->SuccessResponse( |
| 897 QueryUsageAndQuotaResponse::ToValue(params.Pass()).release())); |
| 898 } |
| 899 |
| 900 void Client::ScreencastFrame( |
| 901 ScreencastFrameParams params) { |
| 902 SendNotification("Page.screencastFrame", |
| 903 ScreencastFrameParams::ToValue(params.Pass()).Pass()); |
| 904 } |
| 905 |
| 906 void Client::ScreencastVisibilityChanged( |
| 907 ScreencastVisibilityChangedParams params) { |
| 908 SendNotification("Page.screencastVisibilityChanged", |
| 909 ScreencastVisibilityChangedParams::ToValue(params.Pass()).Pass()); |
| 910 } |
| 911 |
| 912 void Client::ColorPicked( |
| 913 ColorPickedParams params) { |
| 914 SendNotification("Page.colorPicked", |
| 915 ColorPickedParams::ToValue(params.Pass()).Pass()); |
| 916 } |
| 917 |
| 918 void Client::InterstitialShown( |
| 919 InterstitialShownParams params) { |
| 920 SendNotification("Page.interstitialShown", |
| 921 InterstitialShownParams::ToValue(params.Pass()).Pass()); |
| 922 } |
| 923 |
| 924 void Client::InterstitialHidden( |
| 925 InterstitialHiddenParams params) { |
| 926 SendNotification("Page.interstitialHidden", |
| 927 InterstitialHiddenParams::ToValue(params.Pass()).Pass()); |
| 928 } |
| 929 |
| 930 } // namespace page |
| 931 |
| 932 namespace worker { |
| 933 |
| 934 Client::Client(const RawMessageCallback& raw_message_callback) |
| 935 : DevToolsProtocolClient(raw_message_callback) { |
| 936 } |
| 937 |
| 938 Client::~Client() { |
| 939 } |
| 940 |
| 941 void Client::DisconnectedFromWorker( |
| 942 DisconnectedFromWorkerParams params) { |
| 943 SendNotification("Worker.disconnectedFromWorker", |
| 944 DisconnectedFromWorkerParams::ToValue(params.Pass()).Pass()); |
| 945 } |
| 946 |
| 947 } // namespace worker |
| 948 |
| 949 namespace input { |
| 950 namespace emulate_touch_from_mouse_event { |
| 951 const char kTypeMousePressed[] = "mousePressed"; |
| 952 const char kTypeMouseReleased[] = "mouseReleased"; |
| 953 const char kTypeMouseMoved[] = "mouseMoved"; |
| 954 const char kTypeMouseWheel[] = "mouseWheel"; |
| 955 } // namespace emulate_touch_from_mouse_event |
| 956 } // namespace input |
| 957 |
| 958 namespace input { |
| 959 namespace emulate_touch_from_mouse_event { |
| 960 const char kButtonNone[] = "none"; |
| 961 const char kButtonLeft[] = "left"; |
| 962 const char kButtonMiddle[] = "middle"; |
| 963 const char kButtonRight[] = "right"; |
| 964 } // namespace emulate_touch_from_mouse_event |
| 965 } // namespace input |
| 966 |
| 967 namespace tracing { |
| 968 |
| 969 Client::Client(const RawMessageCallback& raw_message_callback) |
| 970 : DevToolsProtocolClient(raw_message_callback) { |
| 971 } |
| 972 |
| 973 Client::~Client() { |
| 974 } |
| 975 |
| 976 void Client::SendStartResponse( |
| 977 scoped_refptr<DevToolsProtocol::Command> command, |
| 978 StartResponse params) { |
| 979 SendAsyncResponse( |
| 980 command->SuccessResponse( |
| 981 StartResponse::ToValue(params.Pass()).release())); |
| 982 } |
| 983 |
| 984 void Client::SendEndResponse( |
| 985 scoped_refptr<DevToolsProtocol::Command> command, |
| 986 EndResponse params) { |
| 987 SendAsyncResponse( |
| 988 command->SuccessResponse( |
| 989 EndResponse::ToValue(params.Pass()).release())); |
| 990 } |
| 991 |
| 992 void Client::SendGetCategoriesResponse( |
| 993 scoped_refptr<DevToolsProtocol::Command> command, |
| 994 GetCategoriesResponse params) { |
| 995 SendAsyncResponse( |
| 996 command->SuccessResponse( |
| 997 GetCategoriesResponse::ToValue(params.Pass()).release())); |
| 998 } |
| 999 |
| 1000 void Client::DataCollected( |
| 1001 DataCollectedParams params) { |
| 1002 SendNotification("Tracing.dataCollected", |
| 1003 DataCollectedParams::ToValue(params.Pass()).Pass()); |
| 1004 } |
| 1005 |
| 1006 void Client::TracingComplete( |
| 1007 TracingCompleteParams params) { |
| 1008 SendNotification("Tracing.tracingComplete", |
| 1009 TracingCompleteParams::ToValue(params.Pass()).Pass()); |
| 1010 } |
| 1011 |
| 1012 void Client::BufferUsage( |
| 1013 BufferUsageParams params) { |
| 1014 SendNotification("Tracing.bufferUsage", |
| 1015 BufferUsageParams::ToValue(params.Pass()).Pass()); |
| 1016 } |
| 1017 |
| 1018 } // namespace tracing |
| 1019 |
| 1020 namespace power { |
| 1021 namespace get_accuracy_level { |
| 1022 const char kResultHigh[] = "high"; |
| 1023 const char kResultModerate[] = "moderate"; |
| 1024 const char kResultLow[] = "low"; |
| 1025 } // namespace get_accuracy_level |
| 1026 } // namespace power |
| 1027 |
| 1028 namespace power { |
| 1029 |
| 1030 Client::Client(const RawMessageCallback& raw_message_callback) |
| 1031 : DevToolsProtocolClient(raw_message_callback) { |
| 1032 } |
| 1033 |
| 1034 Client::~Client() { |
| 1035 } |
| 1036 |
| 1037 void Client::DataAvailable( |
| 1038 DataAvailableParams params) { |
| 1039 SendNotification("Power.dataAvailable", |
| 1040 DataAvailableParams::ToValue(params.Pass()).Pass()); |
| 1041 } |
| 1042 |
| 1043 } // namespace power |
| 1044 |
| 1045 } // namespace devtools |
| 1046 |
| 1047 } // namespace content |
OLD | NEW |