| 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 3628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3639 } | 3639 } |
| 3640 | 3640 |
| 3641 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | 3641 void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
| 3642 int32 page_id, | 3642 int32 page_id, |
| 3643 const PageState& page_state) { | 3643 const PageState& page_state) { |
| 3644 // Ensure that this state update comes from a RenderViewHost that belongs to | 3644 // Ensure that this state update comes from a RenderViewHost that belongs to |
| 3645 // this WebContents. | 3645 // this WebContents. |
| 3646 // TODO(nasko): This should go through RenderFrameHost. | 3646 // TODO(nasko): This should go through RenderFrameHost. |
| 3647 // TODO(creis): We can't update state for cross-process subframes until we | 3647 // TODO(creis): We can't update state for cross-process subframes until we |
| 3648 // have FrameNavigationEntries. Once we do, this should be a DCHECK. | 3648 // have FrameNavigationEntries. Once we do, this should be a DCHECK. |
| 3649 if (rvh->GetDelegate()->GetAsWebContents() != this) | 3649 CHECK_EQ(rvh->GetDelegate()->GetAsWebContents(), this); |
| 3650 return; | |
| 3651 | 3650 |
| 3652 // We must be prepared to handle state updates for any page, these occur | 3651 // We must be prepared to handle state updates for any page, these occur |
| 3653 // when the user is scrolling and entering form data, as well as when we're | 3652 // when the user is scrolling and entering form data, as well as when we're |
| 3654 // leaving a page, in which case our state may have already been moved to | 3653 // leaving a page, in which case our state may have already been moved to |
| 3655 // the next page. The navigation controller will look up the appropriate | 3654 // the next page. The navigation controller will look up the appropriate |
| 3656 // NavigationEntry and update it when it is notified via the delegate. | 3655 // NavigationEntry and update it when it is notified via the delegate. |
| 3657 | 3656 |
| 3658 int entry_index = controller_.GetEntryIndexWithPageID( | 3657 int entry_index = controller_.GetEntryIndexWithPageID( |
| 3659 rvh->GetSiteInstance(), page_id); | 3658 rvh->GetSiteInstance(), page_id); |
| 3660 if (entry_index < 0) | 3659 CHECK_GE(entry_index, 0); |
| 3661 return; | |
| 3662 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); | 3660 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); |
| 3663 | 3661 |
| 3662 // Re http://crbug.com/369661, page id is going away. This function should |
| 3663 // only ever be called for the current entry. When this is verified, this |
| 3664 // function can be greatly simplified. |
| 3665 CHECK_EQ(entry, controller_.GetLastCommittedEntry()); |
| 3666 |
| 3664 if (page_state == entry->GetPageState()) | 3667 if (page_state == entry->GetPageState()) |
| 3665 return; // Nothing to update. | 3668 return; // Nothing to update. |
| 3666 entry->SetPageState(page_state); | 3669 entry->SetPageState(page_state); |
| 3667 controller_.NotifyEntryChanged(entry, entry_index); | 3670 controller_.NotifyEntryChanged(entry, entry_index); |
| 3668 } | 3671 } |
| 3669 | 3672 |
| 3670 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, | 3673 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, |
| 3671 const GURL& url) { | 3674 const GURL& url) { |
| 3672 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { | 3675 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { |
| 3673 // If we're fullscreen only update the url if it's from the fullscreen | 3676 // If we're fullscreen only update the url if it's from the fullscreen |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4429 node->render_manager()->ResumeResponseDeferredAtStart(); | 4432 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4430 } | 4433 } |
| 4431 | 4434 |
| 4432 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4435 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4433 force_disable_overscroll_content_ = force_disable; | 4436 force_disable_overscroll_content_ = force_disable; |
| 4434 if (view_) | 4437 if (view_) |
| 4435 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4438 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4436 } | 4439 } |
| 4437 | 4440 |
| 4438 } // namespace content | 4441 } // namespace content |
| OLD | NEW |