Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 4316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4327 FOR_EACH_OBSERVER(WebContentsObserver, | 4327 FOR_EACH_OBSERVER(WebContentsObserver, |
| 4328 observers_, | 4328 observers_, |
| 4329 RenderProcessGone(GetCrashedStatus())); | 4329 RenderProcessGone(GetCrashedStatus())); |
| 4330 } | 4330 } |
| 4331 | 4331 |
| 4332 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { | 4332 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { |
| 4333 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); | 4333 FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); |
| 4334 } | 4334 } |
| 4335 | 4335 |
| 4336 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | 4336 void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
| 4337 int32_t page_id, | |
| 4338 const PageState& page_state) { | 4337 const PageState& page_state) { |
| 4339 DCHECK(!SiteIsolationPolicy::UseSubframeNavigationEntries()); | 4338 DCHECK(!SiteIsolationPolicy::UseSubframeNavigationEntries()); |
| 4340 | 4339 |
| 4341 // Ensure that this state update comes from a RenderViewHost that belongs to | 4340 // Ensure that this state update comes from a RenderViewHost that belongs to |
| 4342 // this WebContents. | 4341 // this WebContents. |
| 4343 // TODO(nasko): This should go through RenderFrameHost. | 4342 // TODO(nasko): This should go through RenderFrameHost. |
| 4344 if (rvh->GetDelegate()->GetAsWebContents() != this) | 4343 if (rvh->GetDelegate()->GetAsWebContents() != this) |
| 4345 return; | 4344 return; |
| 4346 | 4345 |
| 4347 // We must be prepared to handle state updates for any page. They occur | 4346 if (!rvh->GetMainFrame()) { |
| 4348 // when the user is scrolling and entering form data, as well as when we're | 4347 // For non-oopif, state updates come in on main frames. For oopif, |
|
nasko
2016/10/13 20:39:25
nit: Change oopif with UseSubframeNavigationEntrie
Avi (use Gerrit)
2016/10/13 20:44:35
Done.
| |
| 4349 // leaving a page, in which case our state may have already been moved to | 4348 // UpdateStateForFrame() should have been called instead. |
| 4350 // the next page. The navigation controller will look up the appropriate | 4349 NOTREACHED(); |
| 4351 // NavigationEntry and update it when it is notified via the delegate. | |
| 4352 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(rvh); | |
| 4353 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( | |
| 4354 rvhi->GetSiteInstance(), page_id); | |
| 4355 if (!entry) | |
| 4356 return; | 4350 return; |
| 4351 } | |
| 4357 | 4352 |
| 4358 // Sanity check that ensures nav_entry_id and page_id point to the same | 4353 NavigationEntryImpl* entry = controller_.GetEntryWithUniqueID( |
| 4359 // navigation entry. | 4354 static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame())->nav_entry_id()); |
| 4360 if (rvhi->GetMainFrame()) { | |
| 4361 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( | |
| 4362 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame()) | |
| 4363 ->nav_entry_id()); | |
| 4364 | |
| 4365 DCHECK_EQ(entry, new_entry); | |
| 4366 } | |
| 4367 | 4355 |
| 4368 if (page_state == entry->GetPageState()) | 4356 if (page_state == entry->GetPageState()) |
| 4369 return; // Nothing to update. | 4357 return; // Nothing to update. |
| 4370 entry->SetPageState(page_state); | 4358 entry->SetPageState(page_state); |
| 4371 controller_.NotifyEntryChanged(entry); | 4359 controller_.NotifyEntryChanged(entry); |
| 4372 } | 4360 } |
| 4373 | 4361 |
| 4374 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, | 4362 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, |
| 4375 const GURL& url) { | 4363 const GURL& url) { |
| 4376 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { | 4364 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4580 exploded_state.top.item_sequence_number != | 4568 exploded_state.top.item_sequence_number != |
| 4581 frame_entry->item_sequence_number()) { | 4569 frame_entry->item_sequence_number()) { |
| 4582 return; | 4570 return; |
| 4583 } | 4571 } |
| 4584 | 4572 |
| 4585 frame_entry->SetPageState(page_state); | 4573 frame_entry->SetPageState(page_state); |
| 4586 controller_.NotifyEntryChanged(entry); | 4574 controller_.NotifyEntryChanged(entry); |
| 4587 } | 4575 } |
| 4588 | 4576 |
| 4589 void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host, | 4577 void WebContentsImpl::UpdateTitle(RenderFrameHost* render_frame_host, |
| 4590 int32_t page_id, | |
| 4591 const base::string16& title, | 4578 const base::string16& title, |
| 4592 base::i18n::TextDirection title_direction) { | 4579 base::i18n::TextDirection title_direction) { |
| 4593 // If we have a title, that's a pretty good indication that we've started | 4580 // If we have a title, that's a pretty good indication that we've started |
| 4594 // getting useful data. | 4581 // getting useful data. |
| 4595 SetNotWaitingForResponse(); | 4582 SetNotWaitingForResponse(); |
| 4596 | 4583 |
| 4597 // Try to find the navigation entry, which might not be the current one. | 4584 // Try to find the navigation entry, which might not be the current one. |
| 4598 // For example, it might be from a recently swapped out RFH. | 4585 // For example, it might be from a recently swapped out RFH. |
| 4599 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( | 4586 NavigationEntryImpl* entry = controller_.GetEntryWithUniqueID( |
| 4600 render_frame_host->GetSiteInstance(), page_id); | |
| 4601 | |
| 4602 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( | |
| 4603 static_cast<RenderFrameHostImpl*>(render_frame_host)->nav_entry_id()); | 4587 static_cast<RenderFrameHostImpl*>(render_frame_host)->nav_entry_id()); |
| 4604 if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) { | |
| 4605 // In out-of-process iframe enabled modes, page_id can't keep track of | |
| 4606 // navigations in other processes, so we must use nav_entry_id. | |
| 4607 // TODO(creis): Switch to use this as the default. | |
| 4608 entry = new_entry; | |
| 4609 } | |
| 4610 // (In modes that have no out-of-process iframes, nav_entry_id and page_id | |
| 4611 // will usually agree on which entry to update, but may disagree if commits | |
| 4612 // from a previous RFH have been ignored, resetting the RFH's nav_entry_id.) | |
| 4613 | 4588 |
| 4614 // We can handle title updates when we don't have an entry in | 4589 // We can handle title updates when we don't have an entry in |
| 4615 // UpdateTitleForEntry, but only if the update is from the current RVH. | 4590 // UpdateTitleForEntry, but only if the update is from the current RVH. |
| 4616 // TODO(avi): Change to make decisions based on the RenderFrameHost. | 4591 // TODO(avi): Change to make decisions based on the RenderFrameHost. |
| 4617 if (!entry && render_frame_host != GetMainFrame()) | 4592 if (!entry && render_frame_host != GetMainFrame()) |
| 4618 return; | 4593 return; |
| 4619 | 4594 |
| 4620 // TODO(evan): make use of title_direction. | 4595 // TODO(evan): make use of title_direction. |
| 4621 // http://code.google.com/p/chromium/issues/detail?id=27094 | 4596 // http://code.google.com/p/chromium/issues/detail?id=27094 |
| 4622 UpdateTitleForEntry(entry, title); | 4597 UpdateTitleForEntry(entry, title); |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5255 dialog_manager_ = dialog_manager; | 5230 dialog_manager_ = dialog_manager; |
| 5256 } | 5231 } |
| 5257 | 5232 |
| 5258 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { | 5233 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { |
| 5259 auto it = binding_sets_.find(interface_name); | 5234 auto it = binding_sets_.find(interface_name); |
| 5260 if (it != binding_sets_.end()) | 5235 if (it != binding_sets_.end()) |
| 5261 binding_sets_.erase(it); | 5236 binding_sets_.erase(it); |
| 5262 } | 5237 } |
| 5263 | 5238 |
| 5264 } // namespace content | 5239 } // namespace content |
| OLD | NEW |