Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 281653003: DRAFT CL: Add FrameNavigationEntry and track subframe session histories. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 2029
2030 bool WebContentsImpl::Send(IPC::Message* message) { 2030 bool WebContentsImpl::Send(IPC::Message* message) {
2031 if (!GetRenderViewHost()) { 2031 if (!GetRenderViewHost()) {
2032 delete message; 2032 delete message;
2033 return false; 2033 return false;
2034 } 2034 }
2035 2035
2036 return GetRenderViewHost()->Send(message); 2036 return GetRenderViewHost()->Send(message);
2037 } 2037 }
2038 2038
2039 bool WebContentsImpl::NavigateToPendingEntry(
2040 NavigationController::ReloadType reload_type) {
2041 FrameTreeNode* node = frame_tree_.root();
2042
2043 // Navigate in the FrameTreeNode specified in the pending entry, if any. This
2044 // is currently only used in --site-per-process and tests.
2045 // TODO(creis): Remove this method and NavigationEntryImpl::frame_tree_node_id
2046 // by using FrameNavigationEntries instead. See https://crbug.com/236848.
2047 NavigationEntryImpl* pending_entry = controller_.GetPendingEntry();
2048 if (pending_entry->frame_tree_node_id() != -1) {
2049 FrameTreeNode* subframe =
2050 frame_tree_.FindByID(pending_entry->frame_tree_node_id());
2051 DCHECK(subframe);
2052 if (subframe)
2053 node = subframe;
2054 }
2055
2056 return node->navigator()->NavigateToPendingEntry(node, reload_type);
2057 }
2058
2059 void WebContentsImpl::RenderFrameForInterstitialPageCreated( 2039 void WebContentsImpl::RenderFrameForInterstitialPageCreated(
2060 RenderFrameHost* render_frame_host) { 2040 RenderFrameHost* render_frame_host) {
2061 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2041 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2062 RenderFrameForInterstitialPageCreated(render_frame_host)); 2042 RenderFrameForInterstitialPageCreated(render_frame_host));
2063 } 2043 }
2064 2044
2065 void WebContentsImpl::AttachInterstitialPage( 2045 void WebContentsImpl::AttachInterstitialPage(
2066 InterstitialPageImpl* interstitial_page) { 2046 InterstitialPageImpl* interstitial_page) {
2067 DCHECK(interstitial_page); 2047 DCHECK(interstitial_page);
2068 GetRenderManager()->set_interstitial_page(interstitial_page); 2048 GetRenderManager()->set_interstitial_page(interstitial_page);
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL)) 2604 if (entry && entry->GetURL() == GURL(url::kAboutBlankURL))
2625 return true; 2605 return true;
2626 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); 2606 return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this);
2627 } 2607 }
2628 2608
2629 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { 2609 void WebContentsImpl::SetFocusToLocationBar(bool select_all) {
2630 if (delegate_) 2610 if (delegate_)
2631 delegate_->SetFocusToLocationBar(select_all); 2611 delegate_->SetFocusToLocationBar(select_all);
2632 } 2612 }
2633 2613
2614 FrameTreeNode* WebContentsImpl::GetFrameTreeRoot() {
2615 return frame_tree_.root();
2616 }
2617
2634 void WebContentsImpl::DidStartProvisionalLoad( 2618 void WebContentsImpl::DidStartProvisionalLoad(
2635 RenderFrameHostImpl* render_frame_host, 2619 RenderFrameHostImpl* render_frame_host,
2636 const GURL& validated_url, 2620 const GURL& validated_url,
2637 bool is_error_page, 2621 bool is_error_page,
2638 bool is_iframe_srcdoc) { 2622 bool is_iframe_srcdoc) {
2639 // Notify observers about the start of the provisional load. 2623 // Notify observers about the start of the provisional load.
2640 FOR_EACH_OBSERVER( 2624 FOR_EACH_OBSERVER(
2641 WebContentsObserver, 2625 WebContentsObserver,
2642 observers_, 2626 observers_,
2643 DidStartProvisionalLoadForFrame( 2627 DidStartProvisionalLoadForFrame(
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
3861 // have FrameNavigationEntries. Once we do, this should be a DCHECK. 3845 // have FrameNavigationEntries. Once we do, this should be a DCHECK.
3862 if (rvh->GetDelegate()->GetAsWebContents() != this) 3846 if (rvh->GetDelegate()->GetAsWebContents() != this)
3863 return; 3847 return;
3864 3848
3865 // We must be prepared to handle state updates for any page, these occur 3849 // We must be prepared to handle state updates for any page, these occur
3866 // when the user is scrolling and entering form data, as well as when we're 3850 // when the user is scrolling and entering form data, as well as when we're
3867 // leaving a page, in which case our state may have already been moved to 3851 // leaving a page, in which case our state may have already been moved to
3868 // the next page. The navigation controller will look up the appropriate 3852 // the next page. The navigation controller will look up the appropriate
3869 // NavigationEntry and update it when it is notified via the delegate. 3853 // NavigationEntry and update it when it is notified via the delegate.
3870 3854
3871 int entry_index = controller_.GetEntryIndexWithPageID( 3855 int entry_index = controller_.GetEntryIndexWithPageID(page_id);
3872 rvh->GetSiteInstance(), page_id);
3873 if (entry_index < 0) 3856 if (entry_index < 0)
3874 return; 3857 return;
3875 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); 3858 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index);
3876 3859
3877 if (page_state == entry->GetPageState()) 3860 if (page_state == entry->GetPageState())
3878 return; // Nothing to update. 3861 return; // Nothing to update.
3879 entry->SetPageState(page_state); 3862 entry->SetPageState(page_state);
3880 controller_.NotifyEntryChanged(entry, entry_index); 3863 controller_.NotifyEntryChanged(entry, entry_index);
3881 } 3864 }
3882 3865
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
4038 const base::string16& title, 4021 const base::string16& title,
4039 base::i18n::TextDirection title_direction) { 4022 base::i18n::TextDirection title_direction) {
4040 RenderViewHost* rvh = render_frame_host->GetRenderViewHost(); 4023 RenderViewHost* rvh = render_frame_host->GetRenderViewHost();
4041 4024
4042 // If we have a title, that's a pretty good indication that we've started 4025 // If we have a title, that's a pretty good indication that we've started
4043 // getting useful data. 4026 // getting useful data.
4044 SetNotWaitingForResponse(); 4027 SetNotWaitingForResponse();
4045 4028
4046 // Try to find the navigation entry, which might not be the current one. 4029 // Try to find the navigation entry, which might not be the current one.
4047 // For example, it might be from a pending RVH for the pending entry. 4030 // For example, it might be from a pending RVH for the pending entry.
4048 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( 4031 NavigationEntryImpl* entry = controller_.GetEntryWithPageID(page_id);
4049 rvh->GetSiteInstance(), page_id);
4050 4032
4051 // We can handle title updates when we don't have an entry in 4033 // We can handle title updates when we don't have an entry in
4052 // UpdateTitleForEntry, but only if the update is from the current RVH. 4034 // UpdateTitleForEntry, but only if the update is from the current RVH.
4053 // TODO(avi): Change to make decisions based on the RenderFrameHost. 4035 // TODO(avi): Change to make decisions based on the RenderFrameHost.
4054 if (!entry && rvh != GetRenderViewHost()) 4036 if (!entry && rvh != GetRenderViewHost())
4055 return; 4037 return;
4056 4038
4057 // TODO(evan): make use of title_direction. 4039 // TODO(evan): make use of title_direction.
4058 // http://code.google.com/p/chromium/issues/detail?id=27094 4040 // http://code.google.com/p/chromium/issues/detail?id=27094
4059 if (!UpdateTitleForEntry(entry, title)) 4041 if (!UpdateTitleForEntry(entry, title))
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
4647 node->render_manager()->ResumeResponseDeferredAtStart(); 4629 node->render_manager()->ResumeResponseDeferredAtStart();
4648 } 4630 }
4649 4631
4650 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4632 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4651 force_disable_overscroll_content_ = force_disable; 4633 force_disable_overscroll_content_ = force_disable;
4652 if (view_) 4634 if (view_)
4653 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4635 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4654 } 4636 }
4655 4637
4656 } // namespace content 4638 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/browser/web_contents/web_contents_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698