OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome_frame/cfproxy_private.h" | 5 #include "chrome_frame/cfproxy_private.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include "base/atomic_sequence_num.h" | 8 #include "base/atomic_sequence_num.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 std::wstring command_line_string(command_line->command_line_string()); | 338 std::wstring command_line_string(command_line->command_line_string()); |
339 if (!extra_args.empty()) { | 339 if (!extra_args.empty()) { |
340 command_line_string.append(L" "); | 340 command_line_string.append(L" "); |
341 command_line_string.append(extra_args); | 341 command_line_string.append(extra_args); |
342 } | 342 } |
343 return command_line_string; | 343 return command_line_string; |
344 } | 344 } |
345 | 345 |
346 int IsTabMessage(const IPC::Message& message) { | 346 int IsTabMessage(const IPC::Message& message) { |
347 switch (message.type()) { | 347 switch (message.type()) { |
348 case AutomationMsg_NavigationStateChanged__ID: | 348 case AutomationMsg_NavigationStateChanged::ID: |
349 case AutomationMsg_UpdateTargetUrl__ID: | 349 case AutomationMsg_UpdateTargetUrl::ID: |
350 case AutomationMsg_HandleAccelerator__ID: | 350 case AutomationMsg_HandleAccelerator::ID: |
351 case AutomationMsg_TabbedOut__ID: | 351 case AutomationMsg_TabbedOut::ID: |
352 case AutomationMsg_OpenURL__ID: | 352 case AutomationMsg_OpenURL::ID: |
353 case AutomationMsg_NavigationFailed__ID: | 353 case AutomationMsg_NavigationFailed::ID: |
354 case AutomationMsg_DidNavigate__ID: | 354 case AutomationMsg_DidNavigate::ID: |
355 case AutomationMsg_TabLoaded__ID: | 355 case AutomationMsg_TabLoaded::ID: |
356 case AutomationMsg_ForwardMessageToExternalHost__ID: | 356 case AutomationMsg_ForwardMessageToExternalHost::ID: |
357 case AutomationMsg_ForwardContextMenuToExternalHost__ID: | 357 case AutomationMsg_ForwardContextMenuToExternalHost::ID: |
358 case AutomationMsg_RequestStart__ID: | 358 case AutomationMsg_RequestStart::ID: |
359 case AutomationMsg_RequestRead__ID: | 359 case AutomationMsg_RequestRead::ID: |
360 case AutomationMsg_RequestEnd__ID: | 360 case AutomationMsg_RequestEnd::ID: |
361 case AutomationMsg_DownloadRequestInHost__ID: | 361 case AutomationMsg_DownloadRequestInHost::ID: |
362 case AutomationMsg_SetCookieAsync__ID: | 362 case AutomationMsg_SetCookieAsync::ID: |
363 case AutomationMsg_AttachExternalTab__ID: | 363 case AutomationMsg_AttachExternalTab::ID: |
364 case AutomationMsg_RequestGoToHistoryEntryOffset__ID: | 364 case AutomationMsg_RequestGoToHistoryEntryOffset::ID: |
365 case AutomationMsg_GetCookiesFromHost__ID: | 365 case AutomationMsg_GetCookiesFromHost::ID: |
366 case AutomationMsg_CloseExternalTab__ID: { | 366 case AutomationMsg_CloseExternalTab::ID: { |
367 // Read tab handle from the message. | 367 // Read tab handle from the message. |
368 void* iter = NULL; | 368 void* iter = NULL; |
369 int tab_handle = 0; | 369 int tab_handle = 0; |
370 message.ReadInt(&iter, &tab_handle); | 370 message.ReadInt(&iter, &tab_handle); |
371 return tab_handle; | 371 return tab_handle; |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 return 0; | 375 return 0; |
376 } | 376 } |
377 | 377 |
378 bool DispatchTabMessageToDelegate(ChromeProxyDelegate* delegate, | 378 bool DispatchTabMessageToDelegate(ChromeProxyDelegate* delegate, |
379 const IPC::Message& m) { | 379 const IPC::Message& m) { |
380 // The first argument of the message is always the tab handle. | 380 // The first argument of the message is always the tab handle. |
381 void* iter = 0; | 381 void* iter = 0; |
382 switch (m.type()) { | 382 switch (m.type()) { |
383 case AutomationMsg_NavigationStateChanged__ID: { | 383 case AutomationMsg_NavigationStateChanged::ID: { |
384 // Tuple3<int, int, IPC::NavigationInfo> | 384 // Tuple3<int, int, IPC::NavigationInfo> |
385 AutomationMsg_NavigationStateChanged::Param params; | 385 AutomationMsg_NavigationStateChanged::Param params; |
386 if (ReadParam(&m, &iter, ¶ms)) | 386 if (ReadParam(&m, &iter, ¶ms)) |
387 delegate->NavigationStateChanged(params.b, params.c); | 387 delegate->NavigationStateChanged(params.b, params.c); |
388 return true; | 388 return true; |
389 } | 389 } |
390 | 390 |
391 case AutomationMsg_UpdateTargetUrl__ID: { | 391 case AutomationMsg_UpdateTargetUrl::ID: { |
392 // Tuple2<int, std::wstring> | 392 // Tuple2<int, std::wstring> |
393 AutomationMsg_UpdateTargetUrl::Param params; | 393 AutomationMsg_UpdateTargetUrl::Param params; |
394 if (ReadParam(&m, &iter, ¶ms)) | 394 if (ReadParam(&m, &iter, ¶ms)) |
395 delegate->UpdateTargetUrl(params.b); | 395 delegate->UpdateTargetUrl(params.b); |
396 return true; | 396 return true; |
397 } | 397 } |
398 | 398 |
399 case AutomationMsg_HandleAccelerator__ID: { | 399 case AutomationMsg_HandleAccelerator::ID: { |
400 // Tuple2<int, MSG> | 400 // Tuple2<int, MSG> |
401 AutomationMsg_HandleAccelerator::Param params; | 401 AutomationMsg_HandleAccelerator::Param params; |
402 if (ReadParam(&m, &iter, ¶ms)) | 402 if (ReadParam(&m, &iter, ¶ms)) |
403 delegate->HandleAccelerator(params.b); | 403 delegate->HandleAccelerator(params.b); |
404 return true; | 404 return true; |
405 } | 405 } |
406 | 406 |
407 case AutomationMsg_TabbedOut__ID: { | 407 case AutomationMsg_TabbedOut::ID: { |
408 // Tuple2<int, bool> | 408 // Tuple2<int, bool> |
409 AutomationMsg_TabbedOut::Param params; | 409 AutomationMsg_TabbedOut::Param params; |
410 if (ReadParam(&m, &iter, ¶ms)) | 410 if (ReadParam(&m, &iter, ¶ms)) |
411 delegate->TabbedOut(params.b); | 411 delegate->TabbedOut(params.b); |
412 return true; | 412 return true; |
413 } | 413 } |
414 | 414 |
415 case AutomationMsg_OpenURL__ID: { | 415 case AutomationMsg_OpenURL::ID: { |
416 // Tuple4<int, GURL, GURL, int> | 416 // Tuple4<int, GURL, GURL, int> |
417 AutomationMsg_OpenURL::Param params; | 417 AutomationMsg_OpenURL::Param params; |
418 if (ReadParam(&m, &iter, ¶ms)) | 418 if (ReadParam(&m, &iter, ¶ms)) |
419 delegate->OpenURL(params.b, params.c, params.d); | 419 delegate->OpenURL(params.b, params.c, params.d); |
420 return true; | 420 return true; |
421 } | 421 } |
422 | 422 |
423 case AutomationMsg_NavigationFailed__ID: { | 423 case AutomationMsg_NavigationFailed::ID: { |
424 // Tuple3<int, int, GURL> | 424 // Tuple3<int, int, GURL> |
425 AutomationMsg_NavigationFailed::Param params; | 425 AutomationMsg_NavigationFailed::Param params; |
426 if (ReadParam(&m, &iter, ¶ms)) | 426 if (ReadParam(&m, &iter, ¶ms)) |
427 delegate->NavigationFailed(params.b, params.c); | 427 delegate->NavigationFailed(params.b, params.c); |
428 return true; | 428 return true; |
429 } | 429 } |
430 | 430 |
431 case AutomationMsg_DidNavigate__ID: { | 431 case AutomationMsg_DidNavigate::ID: { |
432 // Tuple2<int, IPC::NavigationInfo> | 432 // Tuple2<int, IPC::NavigationInfo> |
433 AutomationMsg_DidNavigate::Param params; | 433 AutomationMsg_DidNavigate::Param params; |
434 if (ReadParam(&m, &iter, ¶ms)) | 434 if (ReadParam(&m, &iter, ¶ms)) |
435 delegate->DidNavigate(params.b); | 435 delegate->DidNavigate(params.b); |
436 return true; | 436 return true; |
437 } | 437 } |
438 | 438 |
439 case AutomationMsg_TabLoaded__ID: { | 439 case AutomationMsg_TabLoaded::ID: { |
440 // Tuple2<int, GURL> | 440 // Tuple2<int, GURL> |
441 AutomationMsg_TabLoaded::Param params; | 441 AutomationMsg_TabLoaded::Param params; |
442 if (ReadParam(&m, &iter, ¶ms)) | 442 if (ReadParam(&m, &iter, ¶ms)) |
443 delegate->TabLoaded(params.b); | 443 delegate->TabLoaded(params.b); |
444 return true; | 444 return true; |
445 } | 445 } |
446 | 446 |
447 case AutomationMsg_ForwardMessageToExternalHost__ID: { | 447 case AutomationMsg_ForwardMessageToExternalHost::ID: { |
448 // Tuple4<int, string, string, string> | 448 // Tuple4<int, string, string, string> |
449 AutomationMsg_ForwardMessageToExternalHost::Param params; | 449 AutomationMsg_ForwardMessageToExternalHost::Param params; |
450 if (ReadParam(&m, &iter, ¶ms)) | 450 if (ReadParam(&m, &iter, ¶ms)) |
451 delegate->MessageToHost(params.b, params.c, params.d); | 451 delegate->MessageToHost(params.b, params.c, params.d); |
452 return true; | 452 return true; |
453 } | 453 } |
454 | 454 |
455 case AutomationMsg_ForwardContextMenuToExternalHost__ID: { | 455 case AutomationMsg_ForwardContextMenuToExternalHost::ID: { |
456 // Tuple4<int, HANDLE, int, IPC::ContextMenuParams> | 456 // Tuple4<int, HANDLE, int, IPC::ContextMenuParams> |
457 AutomationMsg_ForwardContextMenuToExternalHost::Param params; | 457 AutomationMsg_ForwardContextMenuToExternalHost::Param params; |
458 if (ReadParam(&m, &iter, ¶ms)) | 458 if (ReadParam(&m, &iter, ¶ms)) |
459 delegate->HandleContextMenu(params.b, params.c, params.d); | 459 delegate->HandleContextMenu(params.b, params.c, params.d); |
460 return true; | 460 return true; |
461 } | 461 } |
462 | 462 |
463 case AutomationMsg_RequestStart__ID: { | 463 case AutomationMsg_RequestStart::ID: { |
464 // Tuple3<int, int, IPC::AutomationURLRequest> | 464 // Tuple3<int, int, IPC::AutomationURLRequest> |
465 AutomationMsg_RequestStart::Param params; | 465 AutomationMsg_RequestStart::Param params; |
466 if (ReadParam(&m, &iter, ¶ms)) | 466 if (ReadParam(&m, &iter, ¶ms)) |
467 delegate->Network_Start(params.b, params.c); | 467 delegate->Network_Start(params.b, params.c); |
468 return true; | 468 return true; |
469 } | 469 } |
470 | 470 |
471 case AutomationMsg_RequestRead__ID: { | 471 case AutomationMsg_RequestRead::ID: { |
472 // Tuple3<int, int, int> | 472 // Tuple3<int, int, int> |
473 AutomationMsg_RequestRead::Param params; | 473 AutomationMsg_RequestRead::Param params; |
474 if (ReadParam(&m, &iter, ¶ms)) | 474 if (ReadParam(&m, &iter, ¶ms)) |
475 delegate->Network_Read(params.b, params.c); | 475 delegate->Network_Read(params.b, params.c); |
476 return true; | 476 return true; |
477 } | 477 } |
478 | 478 |
479 case AutomationMsg_RequestEnd__ID: { | 479 case AutomationMsg_RequestEnd::ID: { |
480 // Tuple3<int, int, URLRequestStatus> | 480 // Tuple3<int, int, URLRequestStatus> |
481 AutomationMsg_RequestEnd::Param params; | 481 AutomationMsg_RequestEnd::Param params; |
482 if (ReadParam(&m, &iter, ¶ms)) | 482 if (ReadParam(&m, &iter, ¶ms)) |
483 delegate->Network_End(params.b, params.c); | 483 delegate->Network_End(params.b, params.c); |
484 return true; | 484 return true; |
485 } | 485 } |
486 | 486 |
487 case AutomationMsg_DownloadRequestInHost__ID: { | 487 case AutomationMsg_DownloadRequestInHost::ID: { |
488 // Tuple2<int, int> | 488 // Tuple2<int, int> |
489 AutomationMsg_DownloadRequestInHost::Param params; | 489 AutomationMsg_DownloadRequestInHost::Param params; |
490 if (ReadParam(&m, &iter, ¶ms)) | 490 if (ReadParam(&m, &iter, ¶ms)) |
491 delegate->Network_DownloadInHost(params.b); | 491 delegate->Network_DownloadInHost(params.b); |
492 return true; | 492 return true; |
493 } | 493 } |
494 | 494 |
495 case AutomationMsg_SetCookieAsync__ID: { | 495 case AutomationMsg_SetCookieAsync::ID: { |
496 // Tuple3<int, GURL, string> | 496 // Tuple3<int, GURL, string> |
497 AutomationMsg_SetCookieAsync::Param params; | 497 AutomationMsg_SetCookieAsync::Param params; |
498 if (ReadParam(&m, &iter, ¶ms)) | 498 if (ReadParam(&m, &iter, ¶ms)) |
499 delegate->SetCookie(params.b, params.c); | 499 delegate->SetCookie(params.b, params.c); |
500 return true; | 500 return true; |
501 } | 501 } |
502 | 502 |
503 case AutomationMsg_AttachExternalTab__ID: { | 503 case AutomationMsg_AttachExternalTab::ID: { |
504 // Tuple2<int, IPC::AttachExternalTabParams> | 504 // Tuple2<int, IPC::AttachExternalTabParams> |
505 AutomationMsg_AttachExternalTab::Param params; | 505 AutomationMsg_AttachExternalTab::Param params; |
506 if (ReadParam(&m, &iter, ¶ms)) | 506 if (ReadParam(&m, &iter, ¶ms)) |
507 delegate->AttachTab(params.b); | 507 delegate->AttachTab(params.b); |
508 return true; | 508 return true; |
509 } | 509 } |
510 | 510 |
511 case AutomationMsg_RequestGoToHistoryEntryOffset__ID: { | 511 case AutomationMsg_RequestGoToHistoryEntryOffset::ID: { |
512 // Tuple2<int, int> | 512 // Tuple2<int, int> |
513 AutomationMsg_RequestGoToHistoryEntryOffset::Param params; | 513 AutomationMsg_RequestGoToHistoryEntryOffset::Param params; |
514 if (ReadParam(&m, &iter, ¶ms)) | 514 if (ReadParam(&m, &iter, ¶ms)) |
515 delegate->GoToHistoryOffset(params.b); | 515 delegate->GoToHistoryOffset(params.b); |
516 return true; | 516 return true; |
517 } | 517 } |
518 | 518 |
519 case AutomationMsg_GetCookiesFromHost__ID: { | 519 case AutomationMsg_GetCookiesFromHost::ID: { |
520 // Tuple3<int, GURL, int> | 520 // Tuple3<int, GURL, int> |
521 AutomationMsg_GetCookiesFromHost::Param params; | 521 AutomationMsg_GetCookiesFromHost::Param params; |
522 if (ReadParam(&m, &iter, ¶ms)) | 522 if (ReadParam(&m, &iter, ¶ms)) |
523 delegate->GetCookies(params.b, params.c); | 523 delegate->GetCookies(params.b, params.c); |
524 return true; | 524 return true; |
525 } | 525 } |
526 | 526 |
527 case AutomationMsg_CloseExternalTab__ID: { | 527 case AutomationMsg_CloseExternalTab::ID: { |
528 // Tuple1<int> | 528 // Tuple1<int> |
529 delegate->TabClosed(); | 529 delegate->TabClosed(); |
530 return true; | 530 return true; |
531 } | 531 } |
532 } | 532 } |
533 | 533 |
534 return false; | 534 return false; |
535 } | 535 } |
OLD | NEW |