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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 copy->extra_data_ = extra_data_; | 435 copy->extra_data_ = extra_data_; |
436 | 436 |
437 return copy.Pass(); | 437 return copy.Pass(); |
438 } | 438 } |
439 | 439 |
440 CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( | 440 CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( |
441 const GURL& dest_url, | 441 const GURL& dest_url, |
442 const Referrer& dest_referrer, | 442 const Referrer& dest_referrer, |
443 const FrameNavigationEntry& frame_entry, | 443 const FrameNavigationEntry& frame_entry, |
444 FrameMsg_Navigate_Type::Value navigation_type, | 444 FrameMsg_Navigate_Type::Value navigation_type, |
445 LoFiState lofi_state) const { | 445 LoFiState lofi_state, |
| 446 const base::TimeTicks& navigation_start) const { |
446 FrameMsg_UILoadMetricsReportType::Value report_type = | 447 FrameMsg_UILoadMetricsReportType::Value report_type = |
447 FrameMsg_UILoadMetricsReportType::NO_REPORT; | 448 FrameMsg_UILoadMetricsReportType::NO_REPORT; |
448 base::TimeTicks ui_timestamp = base::TimeTicks(); | 449 base::TimeTicks ui_timestamp = base::TimeTicks(); |
449 #if defined(OS_ANDROID) | 450 #if defined(OS_ANDROID) |
450 if (!intent_received_timestamp().is_null()) | 451 if (!intent_received_timestamp().is_null()) |
451 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT; | 452 report_type = FrameMsg_UILoadMetricsReportType::REPORT_INTENT; |
452 ui_timestamp = intent_received_timestamp(); | 453 ui_timestamp = intent_received_timestamp(); |
453 #endif | 454 #endif |
454 | 455 |
455 return CommonNavigationParams( | 456 return CommonNavigationParams( |
456 dest_url, dest_referrer, GetTransitionType(), navigation_type, | 457 dest_url, dest_referrer, GetTransitionType(), navigation_type, |
457 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, | 458 !IsViewSourceMode(), should_replace_entry(), ui_timestamp, report_type, |
458 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state); | 459 GetBaseURLForDataURL(), GetHistoryURLForDataURL(), lofi_state, |
| 460 navigation_start); |
459 } | 461 } |
460 | 462 |
461 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() | 463 StartNavigationParams NavigationEntryImpl::ConstructStartNavigationParams() |
462 const { | 464 const { |
463 std::vector<unsigned char> browser_initiated_post_data; | 465 std::vector<unsigned char> browser_initiated_post_data; |
464 if (GetBrowserInitiatedPostData()) { | 466 if (GetBrowserInitiatedPostData()) { |
465 browser_initiated_post_data.assign( | 467 browser_initiated_post_data.assign( |
466 GetBrowserInitiatedPostData()->front(), | 468 GetBrowserInitiatedPostData()->front(), |
467 GetBrowserInitiatedPostData()->front() + | 469 GetBrowserInitiatedPostData()->front() + |
468 GetBrowserInitiatedPostData()->size()); | 470 GetBrowserInitiatedPostData()->size()); |
469 } | 471 } |
470 | 472 |
471 return StartNavigationParams(GetHasPostData(), extra_headers(), | 473 return StartNavigationParams(GetHasPostData(), extra_headers(), |
472 browser_initiated_post_data, | 474 browser_initiated_post_data, |
473 #if defined(OS_ANDROID) | 475 #if defined(OS_ANDROID) |
474 has_user_gesture(), | 476 has_user_gesture(), |
475 #endif | 477 #endif |
476 transferred_global_request_id().child_id, | 478 transferred_global_request_id().child_id, |
477 transferred_global_request_id().request_id); | 479 transferred_global_request_id().request_id); |
478 } | 480 } |
479 | 481 |
480 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( | 482 RequestNavigationParams NavigationEntryImpl::ConstructRequestNavigationParams( |
481 const FrameNavigationEntry& frame_entry, | 483 const FrameNavigationEntry& frame_entry, |
482 base::TimeTicks navigation_start, | |
483 bool is_same_document_history_load, | 484 bool is_same_document_history_load, |
484 bool has_committed_real_load, | 485 bool has_committed_real_load, |
485 bool intended_as_new_entry, | 486 bool intended_as_new_entry, |
486 int pending_history_list_offset, | 487 int pending_history_list_offset, |
487 int current_history_list_offset, | 488 int current_history_list_offset, |
488 int current_history_list_length) const { | 489 int current_history_list_length) const { |
489 // Set the redirect chain to the navigation's redirects, unless returning to a | 490 // Set the redirect chain to the navigation's redirects, unless returning to a |
490 // completed navigation (whose previous redirects don't apply). | 491 // completed navigation (whose previous redirects don't apply). |
491 std::vector<GURL> redirects; | 492 std::vector<GURL> redirects; |
492 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { | 493 if (ui::PageTransitionIsNewNavigation(GetTransitionType())) { |
493 redirects = GetRedirectChain(); | 494 redirects = GetRedirectChain(); |
494 } | 495 } |
495 | 496 |
496 int pending_offset_to_send = pending_history_list_offset; | 497 int pending_offset_to_send = pending_history_list_offset; |
497 int current_offset_to_send = current_history_list_offset; | 498 int current_offset_to_send = current_history_list_offset; |
498 int current_length_to_send = current_history_list_length; | 499 int current_length_to_send = current_history_list_length; |
499 if (should_clear_history_list()) { | 500 if (should_clear_history_list()) { |
500 // Set the history list related parameters to the same values a | 501 // Set the history list related parameters to the same values a |
501 // NavigationController would return before its first navigation. This will | 502 // NavigationController would return before its first navigation. This will |
502 // fully clear the RenderView's view of the session history. | 503 // fully clear the RenderView's view of the session history. |
503 pending_offset_to_send = -1; | 504 pending_offset_to_send = -1; |
504 current_offset_to_send = -1; | 505 current_offset_to_send = -1; |
505 current_length_to_send = 0; | 506 current_length_to_send = 0; |
506 } | 507 } |
507 return RequestNavigationParams( | 508 return RequestNavigationParams( |
508 GetIsOverridingUserAgent(), navigation_start, redirects, | 509 GetIsOverridingUserAgent(), redirects, GetCanLoadLocalResources(), |
509 GetCanLoadLocalResources(), base::Time::Now(), frame_entry.page_state(), | 510 base::Time::Now(), frame_entry.page_state(), GetPageID(), GetUniqueID(), |
510 GetPageID(), GetUniqueID(), is_same_document_history_load, | 511 is_same_document_history_load, has_committed_real_load, |
511 has_committed_real_load, intended_as_new_entry, pending_offset_to_send, | 512 intended_as_new_entry, pending_offset_to_send, current_offset_to_send, |
512 current_offset_to_send, current_length_to_send, | 513 current_length_to_send, should_clear_history_list()); |
513 should_clear_history_list()); | |
514 } | 514 } |
515 | 515 |
516 void NavigationEntryImpl::ResetForCommit() { | 516 void NavigationEntryImpl::ResetForCommit() { |
517 // Any state that only matters when a navigation entry is pending should be | 517 // Any state that only matters when a navigation entry is pending should be |
518 // cleared here. | 518 // cleared here. |
519 // TODO(creis): This state should be moved to NavigationRequest once | 519 // TODO(creis): This state should be moved to NavigationRequest once |
520 // PlzNavigate is enabled. | 520 // PlzNavigate is enabled. |
521 SetBrowserInitiatedPostData(nullptr); | 521 SetBrowserInitiatedPostData(nullptr); |
522 set_source_site_instance(nullptr); | 522 set_source_site_instance(nullptr); |
523 set_is_renderer_initiated(false); | 523 set_is_renderer_initiated(false); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 return node; | 607 return node; |
608 } | 608 } |
609 // Enqueue any children and keep looking. | 609 // Enqueue any children and keep looking. |
610 for (auto& child : node->children) | 610 for (auto& child : node->children) |
611 work_queue.push(child); | 611 work_queue.push(child); |
612 } | 612 } |
613 return nullptr; | 613 return nullptr; |
614 } | 614 } |
615 | 615 |
616 } // namespace content | 616 } // namespace content |
OLD | NEW |