| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents/navigation_controller_impl.h" | 5 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_number_conversions.h" // Temporary | 9 #include "base/string_number_conversions.h" // Temporary |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 false, | 646 false, |
| 647 std::string(), | 647 std::string(), |
| 648 browser_context_)); | 648 browser_context_)); |
| 649 entry->SetIsOverridingUserAgent(is_overriding_user_agent); | 649 entry->SetIsOverridingUserAgent(is_overriding_user_agent); |
| 650 entry->SetBaseURLForDataURL(base_url); | 650 entry->SetBaseURLForDataURL(base_url); |
| 651 entry->SetVirtualURL(history_url); | 651 entry->SetVirtualURL(history_url); |
| 652 | 652 |
| 653 LoadEntry(entry); | 653 LoadEntry(entry); |
| 654 } | 654 } |
| 655 | 655 |
| 656 void NavigationControllerImpl::PostURL( |
| 657 const GURL& url, |
| 658 const content::Referrer& referrer, |
| 659 const base::RefCountedMemory& http_body, |
| 660 bool is_overriding_user_agent) { |
| 661 // Must be http scheme for a post request. |
| 662 if (!url.SchemeIs(chrome::kHttpScheme) && |
| 663 !url.SchemeIs(chrome::kHttpsScheme)) { |
| 664 NOTREACHED(); |
| 665 return; |
| 666 } |
| 667 |
| 668 needs_reload_ = false; |
| 669 |
| 670 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| 671 CreateNavigationEntry( |
| 672 url, |
| 673 referrer, |
| 674 content::PAGE_TRANSITION_TYPED, |
| 675 false, |
| 676 std::string(), |
| 677 browser_context_)); |
| 678 entry->SetIsOverridingUserAgent(is_overriding_user_agent); |
| 679 entry->SetHasPostData(true); |
| 680 entry->SetBrowserInitiatedPostData(&http_body); |
| 681 |
| 682 LoadEntry(entry); |
| 683 } |
| 684 |
| 656 void NavigationControllerImpl::DocumentLoadedInFrame() { | 685 void NavigationControllerImpl::DocumentLoadedInFrame() { |
| 657 last_document_loaded_ = base::TimeTicks::Now(); | 686 last_document_loaded_ = base::TimeTicks::Now(); |
| 658 } | 687 } |
| 659 | 688 |
| 660 bool NavigationControllerImpl::RendererDidNavigate( | 689 bool NavigationControllerImpl::RendererDidNavigate( |
| 661 const ViewHostMsg_FrameNavigate_Params& params, | 690 const ViewHostMsg_FrameNavigate_Params& params, |
| 662 content::LoadCommittedDetails* details) { | 691 content::LoadCommittedDetails* details) { |
| 663 | 692 |
| 664 // Save the previous state before we clobber it. | 693 // Save the previous state before we clobber it. |
| 665 if (GetLastCommittedEntry()) { | 694 if (GetLastCommittedEntry()) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 default: | 751 default: |
| 723 NOTREACHED(); | 752 NOTREACHED(); |
| 724 } | 753 } |
| 725 | 754 |
| 726 // All committed entries should have nonempty content state so WebKit doesn't | 755 // All committed entries should have nonempty content state so WebKit doesn't |
| 727 // get confused when we go back to them (see the function for details). | 756 // get confused when we go back to them (see the function for details). |
| 728 DCHECK(!params.content_state.empty()); | 757 DCHECK(!params.content_state.empty()); |
| 729 NavigationEntryImpl* active_entry = | 758 NavigationEntryImpl* active_entry = |
| 730 NavigationEntryImpl::FromNavigationEntry(GetActiveEntry()); | 759 NavigationEntryImpl::FromNavigationEntry(GetActiveEntry()); |
| 731 active_entry->SetContentState(params.content_state); | 760 active_entry->SetContentState(params.content_state); |
| 761 // No longer needed since content state will hold the post data if any. |
| 762 active_entry->SetBrowserInitiatedPostData(NULL); |
| 763 |
| 732 | 764 |
| 733 // Once committed, we do not need to track if the entry was initiated by | 765 // Once committed, we do not need to track if the entry was initiated by |
| 734 // the renderer. | 766 // the renderer. |
| 735 active_entry->set_is_renderer_initiated(false); | 767 active_entry->set_is_renderer_initiated(false); |
| 736 | 768 |
| 737 // The active entry's SiteInstance should match our SiteInstance. | 769 // The active entry's SiteInstance should match our SiteInstance. |
| 738 DCHECK(active_entry->site_instance() == web_contents_->GetSiteInstance()); | 770 DCHECK(active_entry->site_instance() == web_contents_->GetSiteInstance()); |
| 739 | 771 |
| 740 // Now prep the rest of the details for the notification and broadcast. | 772 // Now prep the rest of the details for the notification and broadcast. |
| 741 details->entry = active_entry; | 773 details->entry = active_entry; |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 for (int i = 0; i < max_index; i++) { | 1516 for (int i = 0; i < max_index; i++) { |
| 1485 // When cloning a tab, copy all entries except interstitial pages | 1517 // When cloning a tab, copy all entries except interstitial pages |
| 1486 if (source.entries_[i].get()->GetPageType() != | 1518 if (source.entries_[i].get()->GetPageType() != |
| 1487 content::PAGE_TYPE_INTERSTITIAL) { | 1519 content::PAGE_TYPE_INTERSTITIAL) { |
| 1488 entries_.insert(entries_.begin() + insert_index++, | 1520 entries_.insert(entries_.begin() + insert_index++, |
| 1489 linked_ptr<NavigationEntryImpl>( | 1521 linked_ptr<NavigationEntryImpl>( |
| 1490 new NavigationEntryImpl(*source.entries_[i]))); | 1522 new NavigationEntryImpl(*source.entries_[i]))); |
| 1491 } | 1523 } |
| 1492 } | 1524 } |
| 1493 } | 1525 } |
| OLD | NEW |