OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/frame_host/navigation_entry_impl.h" | 5 #include "content/browser/frame_host/navigation_entry_impl.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 copy->extra_data_ = extra_data_; | 448 copy->extra_data_ = extra_data_; |
449 | 449 |
450 return copy.Pass(); | 450 return copy.Pass(); |
451 } | 451 } |
452 | 452 |
453 CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( | 453 CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( |
454 const GURL& dest_url, | 454 const GURL& dest_url, |
455 const Referrer& dest_referrer, | 455 const Referrer& dest_referrer, |
456 const FrameNavigationEntry& frame_entry, | 456 const FrameNavigationEntry& frame_entry, |
457 FrameMsg_Navigate_Type::Value navigation_type, | 457 FrameMsg_Navigate_Type::Value navigation_type, |
458 LoFiState lofi_state) const { | 458 LoFiState lofi_state, |
| 459 const base::TimeTicks& navigation_start) const { |
459 FrameMsg_UILoadMetricsReportType::Value report_type = | 460 FrameMsg_UILoadMetricsReportType::Value report_type = |
460 FrameMsg_UILoadMetricsReportType::NO_REPORT; | 461 FrameMsg_UILoadMetricsReportType::NO_REPORT; |
461 base::TimeTicks ui_timestamp = base::TimeTicks(); | 462 base::TimeTicks ui_timestamp = base::TimeTicks(); |
462 #if defined(OS_ANDROID) | 463 #if defined(OS_ANDROID) |
463 if (!intent_received_timestamp().is_null()) | 464 if (!intent_received_timestamp().is_null()) |
464 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT; | 465 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT; |
465 ui_timestamp = intent_received_timestamp(); | 466 ui_timestamp = intent_received_timestamp(); |
466 #endif | 467 #endif |
467 | 468 |
468 return CommonNavigationParams( | 469 return CommonNavigationParams( |
469 dest_url, dest_referrer, GetTransitionType(), navigation_type, | 470 dest_url, dest_referrer, GetTransitionType(), navigation_type, |
470 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, | 471 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, |
471 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state); | 472 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, |
| 473 navigation_start); |
472 } | 474 } |
473 | 475 |
474 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() | 476 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() |
475 const { | 477 const { |
476 std::vector<unsigned char> browser_initiated_post_data; | 478 std::vector<unsigned char> browser_initiated_post_data; |
477 if (GetBrowserInitiatedPostData()) { | 479 if (GetBrowserInitiatedPostData()) { |
478 browser_initiated_post_data.assign( | 480 browser_initiated_post_data.assign( |
479 GetBrowserInitiatedPostData()->front(), | 481 GetBrowserInitiatedPostData()->front(), |
480 GetBrowserInitiatedPostData()->front() + | 482 GetBrowserInitiatedPostData()->front() + |
481 GetBrowserInitiatedPostData()->size()); | 483 GetBrowserInitiatedPostData()->size()); |
482 } | 484 } |
483 | 485 |
484 return StartNavigationParams(GetHasPostData(), extra_headers(), | 486 return StartNavigationParams(GetHasPostData(), extra_headers(), |
485 browser_initiated_post_data, | 487 browser_initiated_post_data, |
486 #if defined(OS_ANDROID) | 488 #if defined(OS_ANDROID) |
487 has_user_gesture(), | 489 has_user_gesture(), |
488 #endif | 490 #endif |
489 transferred_global_request_id().child_id, | 491 transferred_global_request_id().child_id, |
490 transferred_global_request_id().request_id); | 492 transferred_global_request_id().request_id); |
491 } | 493 } |
492 | 494 |
493 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( | 495 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
494 const FrameNavigationEntry& frame_entry, | 496 const FrameNavigationEntry& frame_entry, |
495 base::TimeTicks navigation_start, | |
496 bool is_same_document_history_load, | 497 bool is_same_document_history_load, |
497 bool has_committed_real_load, | 498 bool has_committed_real_load, |
498 bool intended_as_new_entry, | 499 bool intended_as_new_entry, |
499 int pending_history_list_offset, | 500 int pending_history_list_offset, |
500 int current_history_list_offset, | 501 int current_history_list_offset, |
501 int current_history_list_length) const { | 502 int current_history_list_length) const { |
502 // Set the redirect chain to the navigation's redirects, unless returning to a | 503 // Set the redirect chain to the navigation's redirects, unless returning to a |
503 // completed navigation (whose previous redirects don't apply). | 504 // completed navigation (whose previous redirects don't apply). |
504 std::vector<GURL> redirects; | 505 std::vector<GURL> redirects; |
505 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { | 506 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { |
506 redirects = GetRedirectChain(); | 507 redirects = GetRedirectChain(); |
507 } | 508 } |
508 | 509 |
509 int pending_offset_to_send = pending_history_list_offset; | 510 int pending_offset_to_send = pending_history_list_offset; |
510 int current_offset_to_send = current_history_list_offset; | 511 int current_offset_to_send = current_history_list_offset; |
511 int current_length_to_send = current_history_list_length; | 512 int current_length_to_send = current_history_list_length; |
512 if (should_clear_history_list()) { | 513 if (should_clear_history_list()) { |
513 // Set the history list related parameters to the same values a | 514 // Set the history list related parameters to the same values a |
514 // NavigationController would return before its first navigation. This will | 515 // NavigationController would return before its first navigation. This will |
515 // fully clear the RenderView's view of the session history. | 516 // fully clear the RenderView's view of the session history. |
516 pending_offset_to_send = -1; | 517 pending_offset_to_send = -1; |
517 current_offset_to_send = -1; | 518 current_offset_to_send = -1; |
518 current_length_to_send = 0; | 519 current_length_to_send = 0; |
519 } | 520 } |
520 return RequestNavigationParams( | 521 return RequestNavigationParams( |
521 GetIsOverridingUserAgent(), navigation_start, redirects, | 522 GetIsOverridingUserAgent(), redirects, GetCanLoadLocalResources(), |
522 GetCanLoadLocalResources(), base::Time::Now(), frame_entry.page_state(), | 523 base::Time::Now(), frame_entry.page_state(), GetPageID(), GetUniqueID(), |
523 GetPageID(), GetUniqueID(), is_same_document_history_load, | 524 is_same_document_history_load, has_committed_real_load, |
524 has_committed_real_load, intended_as_new_entry, pending_offset_to_send, | 525 intended_as_new_entry, pending_offset_to_send, current_offset_to_send, |
525 current_offset_to_send, current_length_to_send, | 526 current_length_to_send, should_clear_history_list()); |
526 should_clear_history_list()); | |
527 } | 527 } |
528 | 528 |
529 void NavigationEntryImpl::ResetForCommit() { | 529 void NavigationEntryImpl::ResetForCommit() { |
530 // Any state that only matters when a navigation entry is pending should be | 530 // Any state that only matters when a navigation entry is pending should be |
531 // cleared here. | 531 // cleared here. |
532 // TODO(creis): This state should be moved to NavigationRequest once | 532 // TODO(creis): This state should be moved to NavigationRequest once |
533 // PlzNavigate is enabled. | 533 // PlzNavigate is enabled. |
534 SetBrowserInitiatedPostData(nullptr); | 534 SetBrowserInitiatedPostData(nullptr); |
535 set_source_site_instance(nullptr); | 535 set_source_site_instance(nullptr); |
536 set_is_renderer_initiated(false); | 536 set_is_renderer_initiated(false); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 return node; | 620 return node; |
621 } | 621 } |
622 // Enqueue any children and keep looking. | 622 // Enqueue any children and keep looking. |
623 for (auto& child : node->children) | 623 for (auto& child : node->children) |
624 work_queue.push(child); | 624 work_queue.push(child); |
625 } | 625 } |
626 return nullptr; | 626 return nullptr; |
627 } | 627 } |
628 | 628 |
629 } // namespace content | 629 } // namespace content |
OLD | NEW |