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/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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1936 DidAttachInterstitialPage()); | 1936 DidAttachInterstitialPage()); |
1937 } | 1937 } |
1938 | 1938 |
1939 void WebContentsImpl::DetachInterstitialPage() { | 1939 void WebContentsImpl::DetachInterstitialPage() { |
1940 if (ShowingInterstitialPage()) | 1940 if (ShowingInterstitialPage()) |
1941 GetRenderManager()->remove_interstitial_page(); | 1941 GetRenderManager()->remove_interstitial_page(); |
1942 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1942 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
1943 DidDetachInterstitialPage()); | 1943 DidDetachInterstitialPage()); |
1944 } | 1944 } |
1945 | 1945 |
1946 void WebContentsImpl::SetHistoryLengthAndPrune( | 1946 void WebContentsImpl::SetHistoryOffsetAndLength(int history_offset, |
1947 const SiteInstance* site_instance, | 1947 int history_length) { |
1948 int history_length, | 1948 SetHistoryOffsetAndLengthForView( |
1949 int32 minimum_page_id) { | 1949 GetRenderViewHost(), history_offset, history_length); |
1950 // SetHistoryLengthAndPrune doesn't work when there are pending cross-site | 1950 } |
1951 // navigations. Callers should ensure that this is the case. | 1951 |
1952 if (GetRenderManager()->pending_render_view_host()) { | 1952 void WebContentsImpl::SetHistoryOffsetAndLengthForView( |
1953 NOTREACHED(); | 1953 RenderViewHost* render_view_host, |
1954 return; | 1954 int history_offset, |
1955 } | 1955 int history_length) { |
1956 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); | 1956 render_view_host->Send(new ViewMsg_SetHistoryOffsetAndLength( |
1957 if (!rvh) { | 1957 render_view_host->GetRoutingID(), history_offset, history_length)); |
1958 NOTREACHED(); | |
1959 return; | |
1960 } | |
1961 if (site_instance && rvh->GetSiteInstance() != site_instance) { | |
1962 NOTREACHED(); | |
1963 return; | |
1964 } | |
1965 Send(new ViewMsg_SetHistoryLengthAndPrune(GetRoutingID(), | |
1966 history_length, | |
1967 minimum_page_id)); | |
1968 } | 1958 } |
1969 | 1959 |
1970 void WebContentsImpl::ReloadFocusedFrame(bool ignore_cache) { | 1960 void WebContentsImpl::ReloadFocusedFrame(bool ignore_cache) { |
1971 RenderFrameHost* focused_frame = GetFocusedFrame(); | 1961 RenderFrameHost* focused_frame = GetFocusedFrame(); |
1972 if (!focused_frame) | 1962 if (!focused_frame) |
1973 return; | 1963 return; |
1974 | 1964 |
1975 focused_frame->Send(new FrameMsg_Reload( | 1965 focused_frame->Send(new FrameMsg_Reload( |
1976 focused_frame->GetRoutingID(), ignore_cache)); | 1966 focused_frame->GetRoutingID(), ignore_cache)); |
1977 } | 1967 } |
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4141 | 4131 |
4142 if (!static_cast<RenderViewHostImpl*>( | 4132 if (!static_cast<RenderViewHostImpl*>( |
4143 render_view_host)->CreateRenderView(base::string16(), | 4133 render_view_host)->CreateRenderView(base::string16(), |
4144 opener_route_id, | 4134 opener_route_id, |
4145 proxy_routing_id, | 4135 proxy_routing_id, |
4146 max_page_id, | 4136 max_page_id, |
4147 created_with_opener_)) { | 4137 created_with_opener_)) { |
4148 return false; | 4138 return false; |
4149 } | 4139 } |
4150 | 4140 |
| 4141 SetHistoryOffsetAndLengthForView(render_view_host, |
| 4142 controller_.GetLastCommittedEntryIndex(), |
| 4143 controller_.GetEntryCount()); |
| 4144 |
4151 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 4145 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
4152 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on | 4146 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on |
4153 // linux. See crbug.com/83941. | 4147 // linux. See crbug.com/83941. |
4154 if (rwh_view) { | 4148 if (rwh_view) { |
4155 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) | 4149 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) |
4156 render_widget_host->WasResized(); | 4150 render_widget_host->WasResized(); |
4157 } | 4151 } |
4158 #endif | 4152 #endif |
4159 | 4153 |
4160 return true; | 4154 return true; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4361 node->render_manager()->ResumeResponseDeferredAtStart(); | 4355 node->render_manager()->ResumeResponseDeferredAtStart(); |
4362 } | 4356 } |
4363 | 4357 |
4364 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4358 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4365 force_disable_overscroll_content_ = force_disable; | 4359 force_disable_overscroll_content_ = force_disable; |
4366 if (view_) | 4360 if (view_) |
4367 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4361 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4368 } | 4362 } |
4369 | 4363 |
4370 } // namespace content | 4364 } // namespace content |
OLD | NEW |