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 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 WebContentsObserver, | 2230 WebContentsObserver, |
2231 observers_, | 2231 observers_, |
2232 DidCommitProvisionalLoadForFrame(render_frame_id, | 2232 DidCommitProvisionalLoadForFrame(render_frame_id, |
2233 frame_unique_name, | 2233 frame_unique_name, |
2234 is_main_frame, | 2234 is_main_frame, |
2235 url, | 2235 url, |
2236 transition_type, | 2236 transition_type, |
2237 render_view_host)); | 2237 render_view_host)); |
2238 } | 2238 } |
2239 | 2239 |
| 2240 void WebContentsImpl::DidNavigateMainFramePreCommit( |
| 2241 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| 2242 // Ensure fullscreen mode is exited before committing the navigation to a |
| 2243 // different page. The next page will not start out assuming it is in |
| 2244 // fullscreen mode. |
| 2245 if (params.was_within_same_page) { |
| 2246 // No document change? Then, the renderer shall decide whether to exit |
| 2247 // fullscreen. |
| 2248 return; |
| 2249 } |
| 2250 if (IsFullscreenForCurrentTab()) |
| 2251 GetRenderViewHost()->ExitFullscreen(); |
| 2252 DCHECK(!IsFullscreenForCurrentTab()); |
| 2253 } |
| 2254 |
2240 void WebContentsImpl::DidNavigateMainFramePostCommit( | 2255 void WebContentsImpl::DidNavigateMainFramePostCommit( |
2241 const LoadCommittedDetails& details, | 2256 const LoadCommittedDetails& details, |
2242 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 2257 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
2243 if (details.is_navigation_to_different_page()) { | 2258 if (details.is_navigation_to_different_page()) { |
2244 // Clear the status bubble. This is a workaround for a bug where WebKit | 2259 // Clear the status bubble. This is a workaround for a bug where WebKit |
2245 // doesn't let us know that the cursor left an element during a | 2260 // doesn't let us know that the cursor left an element during a |
2246 // transition (this is also why the mouse cursor remains as a hand after | 2261 // transition (this is also why the mouse cursor remains as a hand after |
2247 // clicking on a link); see bugs 1184641 and 980803. We don't want to | 2262 // clicking on a link); see bugs 1184641 and 980803. We don't want to |
2248 // clear the bubble when a user navigates to a named anchor in the same | 2263 // clear the bubble when a user navigates to a named anchor in the same |
2249 // page. | 2264 // page. |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3045 return; | 3060 return; |
3046 } | 3061 } |
3047 #endif | 3062 #endif |
3048 | 3063 |
3049 // Ignore this if it comes from a RenderViewHost that we aren't showing. | 3064 // Ignore this if it comes from a RenderViewHost that we aren't showing. |
3050 if (delegate_ && rvh == GetRenderViewHost()) | 3065 if (delegate_ && rvh == GetRenderViewHost()) |
3051 delegate_->CloseContents(this); | 3066 delegate_->CloseContents(this); |
3052 } | 3067 } |
3053 | 3068 |
3054 void WebContentsImpl::SwappedOut(RenderFrameHost* rfh) { | 3069 void WebContentsImpl::SwappedOut(RenderFrameHost* rfh) { |
3055 // TODO(creis): Handle subframes that go fullscreen. | 3070 if (delegate_ && rfh->GetRenderViewHost() == GetRenderViewHost()) |
3056 if (rfh->GetRenderViewHost() == GetRenderViewHost()) { | 3071 delegate_->SwappedOut(this); |
3057 // Exit fullscreen mode before the current RVH is swapped out. For numerous | |
3058 // cases, there is no guarantee the renderer would/could initiate an exit. | |
3059 // Example: http://crbug.com/347232 | |
3060 if (IsFullscreenForCurrentTab()) { | |
3061 rfh->GetRenderViewHost()->ExitFullscreen(); | |
3062 DCHECK(!IsFullscreenForCurrentTab()); | |
3063 } | |
3064 | |
3065 if (delegate_) | |
3066 delegate_->SwappedOut(this); | |
3067 } | |
3068 } | 3072 } |
3069 | 3073 |
3070 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { | 3074 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { |
3071 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 3075 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
3072 delegate_->MoveContents(this, new_bounds); | 3076 delegate_->MoveContents(this, new_bounds); |
3073 } | 3077 } |
3074 | 3078 |
3075 void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host, | 3079 void WebContentsImpl::DidStartLoading(RenderFrameHost* render_frame_host, |
3076 bool to_different_document) { | 3080 bool to_different_document) { |
3077 SetIsLoading(render_frame_host->GetRenderViewHost(), true, | 3081 SetIsLoading(render_frame_host->GetRenderViewHost(), true, |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3674 | 3678 |
3675 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3679 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3676 if (!delegate_) | 3680 if (!delegate_) |
3677 return; | 3681 return; |
3678 const gfx::Size new_size = GetPreferredSize(); | 3682 const gfx::Size new_size = GetPreferredSize(); |
3679 if (new_size != old_size) | 3683 if (new_size != old_size) |
3680 delegate_->UpdatePreferredSize(this, new_size); | 3684 delegate_->UpdatePreferredSize(this, new_size); |
3681 } | 3685 } |
3682 | 3686 |
3683 } // namespace content | 3687 } // namespace content |
OLD | NEW |