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/browser/automation/url_request_automation_job.h" | 5 #include "chrome/browser/automation/url_request_automation_job.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/browser/automation/automation_resource_message_filter.h" | 10 #include "chrome/browser/automation/automation_resource_message_filter.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 430 |
431 // Get the resource type (main_frame/script/image/stylesheet etc. | 431 // Get the resource type (main_frame/script/image/stylesheet etc. |
432 ResourceDispatcherHostRequestInfo* request_info = | 432 ResourceDispatcherHostRequestInfo* request_info = |
433 ResourceDispatcherHost::InfoForRequest(request_); | 433 ResourceDispatcherHost::InfoForRequest(request_); |
434 ResourceType::Type resource_type = ResourceType::MAIN_FRAME; | 434 ResourceType::Type resource_type = ResourceType::MAIN_FRAME; |
435 if (request_info) { | 435 if (request_info) { |
436 resource_type = request_info->resource_type(); | 436 resource_type = request_info->resource_type(); |
437 } | 437 } |
438 | 438 |
439 // Ask automation to start this request. | 439 // Ask automation to start this request. |
440 IPC::AutomationURLRequest automation_request = { | 440 IPC::AutomationURLRequest automation_request( |
441 request_->url().spec(), | 441 request_->url().spec(), |
442 request_->method(), | 442 request_->method(), |
443 referrer.spec(), | 443 referrer.spec(), |
444 new_request_headers.ToString(), | 444 new_request_headers.ToString(), |
445 request_->get_upload(), | 445 request_->get_upload(), |
446 resource_type, | 446 resource_type, |
447 request_->load_flags() | 447 request_->load_flags()); |
448 }; | |
449 | 448 |
450 DCHECK(message_filter_); | 449 DCHECK(message_filter_); |
451 message_filter_->Send(new AutomationMsg_RequestStart(0, tab_, id_, | 450 message_filter_->Send(new AutomationMsg_RequestStart(0, tab_, id_, |
452 automation_request)); | 451 automation_request)); |
453 } | 452 } |
454 | 453 |
455 void URLRequestAutomationJob::DisconnectFromMessageFilter() { | 454 void URLRequestAutomationJob::DisconnectFromMessageFilter() { |
456 if (message_filter_) { | 455 if (message_filter_) { |
457 message_filter_->UnRegisterRequest(this); | 456 message_filter_->UnRegisterRequest(this); |
458 message_filter_ = NULL; | 457 message_filter_ = NULL; |
(...skipping 14 matching lines...) Expand all Loading... |
473 if (!is_done()) { | 472 if (!is_done()) { |
474 NotifyDone(request_status_); | 473 NotifyDone(request_status_); |
475 } | 474 } |
476 // Reset any pending reads. | 475 // Reset any pending reads. |
477 if (pending_buf_) { | 476 if (pending_buf_) { |
478 pending_buf_ = NULL; | 477 pending_buf_ = NULL; |
479 pending_buf_size_ = 0; | 478 pending_buf_size_ = 0; |
480 NotifyReadComplete(0); | 479 NotifyReadComplete(0); |
481 } | 480 } |
482 } | 481 } |
OLD | NEW |