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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 4189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4200 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 4200 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
4201 DocumentOnLoadCompletedInMainFrame()); | 4201 DocumentOnLoadCompletedInMainFrame()); |
4202 | 4202 |
4203 // TODO(avi): Remove. http://crbug.com/170921 | 4203 // TODO(avi): Remove. http://crbug.com/170921 |
4204 NotificationService::current()->Notify( | 4204 NotificationService::current()->Notify( |
4205 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 4205 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
4206 Source<WebContents>(this), | 4206 Source<WebContents>(this), |
4207 NotificationService::NoDetails()); | 4207 NotificationService::NoDetails()); |
4208 } | 4208 } |
4209 | 4209 |
4210 void WebContentsImpl::UpdateStateForFrame(RenderFrameHost* render_frame_host, | 4210 void WebContentsImpl::UpdateStateForFrame( |
4211 const PageState& page_state) { | 4211 RenderFrameHost* render_frame_host, |
| 4212 const ExplodedFrameState& frame_state) { |
4212 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); | 4213 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); |
4213 | 4214 |
4214 // The state update affects the last NavigationEntry associated with the given | 4215 // The state update affects the last NavigationEntry associated with the given |
4215 // |render_frame_host|. This may not be the last committed NavigationEntry (as | 4216 // |render_frame_host|. This may not be the last committed NavigationEntry (as |
4216 // in the case of an UpdateState from a frame being swapped out). We track | 4217 // in the case of an UpdateState from a frame being swapped out). We track |
4217 // which entry this is in the RenderFrameHost's nav_entry_id. | 4218 // which entry this is in the RenderFrameHost's nav_entry_id. |
4218 RenderFrameHostImpl* rfhi = | 4219 RenderFrameHostImpl* rfhi = |
4219 static_cast<RenderFrameHostImpl*>(render_frame_host); | 4220 static_cast<RenderFrameHostImpl*>(render_frame_host); |
4220 NavigationEntryImpl* entry = | 4221 NavigationEntryImpl* entry = |
4221 controller_.GetEntryWithUniqueID(rfhi->nav_entry_id()); | 4222 controller_.GetEntryWithUniqueID(rfhi->nav_entry_id()); |
4222 if (!entry) | 4223 if (!entry) |
4223 return; | 4224 return; |
4224 | 4225 |
4225 FrameNavigationEntry* frame_entry = | 4226 FrameNavigationEntry* frame_entry = |
4226 entry->GetFrameEntry(rfhi->frame_tree_node()); | 4227 entry->GetFrameEntry(rfhi->frame_tree_node()); |
4227 if (!frame_entry) | 4228 if (!frame_entry) |
4228 return; | 4229 return; |
4229 | 4230 |
4230 // The SiteInstance might not match if we do a cross-process navigation with | 4231 // The SiteInstance might not match if we do a cross-process navigation with |
4231 // replacement (e.g., auto-subframe), in which case the swap out of the old | 4232 // replacement (e.g., auto-subframe), in which case the swap out of the old |
4232 // RenderFrameHost runs in the background after the old FrameNavigationEntry | 4233 // RenderFrameHost runs in the background after the old FrameNavigationEntry |
4233 // has already been replaced and destroyed. | 4234 // has already been replaced and destroyed. |
4234 if (frame_entry->site_instance() != rfhi->GetSiteInstance()) | 4235 if (frame_entry->site_instance() != rfhi->GetSiteInstance()) |
4235 return; | 4236 return; |
4236 | 4237 |
4237 if (page_state == frame_entry->page_state()) | 4238 PageState old_page_state = entry->GetPageState(); |
4238 return; // Nothing to update. | |
4239 | 4239 |
4240 frame_entry->set_page_state(page_state); | 4240 frame_entry->set_frame_state(frame_state); |
| 4241 entry->UpdatePageState(); |
| 4242 |
| 4243 if (entry->GetPageState() == old_page_state) |
| 4244 return; // No reason to notify. |
| 4245 |
4241 controller_.NotifyEntryChanged(entry); | 4246 controller_.NotifyEntryChanged(entry); |
4242 } | 4247 } |
4243 | 4248 |
4244 void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host, | 4249 void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host, |
4245 int32 page_id, | 4250 int32 page_id, |
4246 const base::string16& title, | 4251 const base::string16& title, |
4247 base::i18n::TextDirection title_direction) { | 4252 base::i18n::TextDirection title_direction) { |
4248 // If we have a title, that's a pretty good indication that we've started | 4253 // If we have a title, that's a pretty good indication that we've started |
4249 // getting useful data. | 4254 // getting useful data. |
4250 SetNotWaitingForResponse(); | 4255 SetNotWaitingForResponse(); |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4840 return NULL; | 4845 return NULL; |
4841 } | 4846 } |
4842 | 4847 |
4843 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4848 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4844 force_disable_overscroll_content_ = force_disable; | 4849 force_disable_overscroll_content_ = force_disable; |
4845 if (view_) | 4850 if (view_) |
4846 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4851 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4847 } | 4852 } |
4848 | 4853 |
4849 } // namespace content | 4854 } // namespace content |
OLD | NEW |