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 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2234 // Because this will not tear down the interstitial properly, if "back" is | 2234 // Because this will not tear down the interstitial properly, if "back" is |
2235 // back to another tab type, the interstitial will still be somewhat alive | 2235 // back to another tab type, the interstitial will still be somewhat alive |
2236 // in the previous tab type. If you navigate somewhere that activates the | 2236 // in the previous tab type. If you navigate somewhere that activates the |
2237 // tab with the interstitial again, you'll see a flash before the new load | 2237 // tab with the interstitial again, you'll see a flash before the new load |
2238 // commits of the interstitial page. | 2238 // commits of the interstitial page. |
2239 if (ShowingInterstitialPage()) { | 2239 if (ShowingInterstitialPage()) { |
2240 LOG(WARNING) << "Discarding message during interstitial."; | 2240 LOG(WARNING) << "Discarding message during interstitial."; |
2241 return; | 2241 return; |
2242 } | 2242 } |
2243 | 2243 |
2244 // Do not clear the pending entry if one exists, so that the user's typed | |
2245 // URL is not lost when a navigation fails or is aborted. We'll allow | |
2246 // the view to clear the pending entry and typed URL if the user requests. | |
2247 | |
2248 render_manager_.RendererAbortedProvisionalLoad(render_view_host); | 2244 render_manager_.RendererAbortedProvisionalLoad(render_view_host); |
2249 } | 2245 } |
2250 | 2246 |
| 2247 // Do not usually clear the pending entry if one exists, so that the user's |
| 2248 // typed URL is not lost when a navigation fails or is aborted. However, in |
| 2249 // cases that we don't show the pending entry (e.g., renderer-initiated |
| 2250 // navigations in an existing tab), we don't keep it around. That prevents |
| 2251 // spoofs on in-page navigations that don't go through |
| 2252 // DidStartProvisionalLoadForFrame. |
| 2253 // In general, we allow the view to clear the pending entry and typed URL if |
| 2254 // the user requests (e.g., hitting Escape with focus in the address bar). |
| 2255 // Note: don't touch the transient entry, since an interstitial may exist. |
| 2256 if (controller_.GetPendingEntry() != controller_.GetVisibleEntry()) |
| 2257 controller_.DiscardPendingEntry(); |
| 2258 |
2251 FOR_EACH_OBSERVER(WebContentsObserver, | 2259 FOR_EACH_OBSERVER(WebContentsObserver, |
2252 observers_, | 2260 observers_, |
2253 DidFailProvisionalLoad(params.frame_id, | 2261 DidFailProvisionalLoad(params.frame_id, |
2254 params.is_main_frame, | 2262 params.is_main_frame, |
2255 validated_url, | 2263 validated_url, |
2256 params.error_code, | 2264 params.error_code, |
2257 params.error_description, | 2265 params.error_description, |
2258 render_view_host)); | 2266 render_view_host)); |
2259 } | 2267 } |
2260 | 2268 |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3754 gfx::Size WebContentsImpl::GetSizeForNewRenderView() const { | 3762 gfx::Size WebContentsImpl::GetSizeForNewRenderView() const { |
3755 gfx::Size size; | 3763 gfx::Size size; |
3756 if (delegate_) | 3764 if (delegate_) |
3757 size = delegate_->GetSizeForNewRenderView(this); | 3765 size = delegate_->GetSizeForNewRenderView(this); |
3758 if (size.IsEmpty()) | 3766 if (size.IsEmpty()) |
3759 size = view_->GetContainerSize(); | 3767 size = view_->GetContainerSize(); |
3760 return size; | 3768 return size; |
3761 } | 3769 } |
3762 | 3770 |
3763 } // namespace content | 3771 } // namespace content |
OLD | NEW |