| 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 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3627 // TODO(creis): We can't update state for cross-process subframes until we | 3627 // TODO(creis): We can't update state for cross-process subframes until we |
| 3628 // have FrameNavigationEntries. Once we do, this should be a DCHECK. | 3628 // have FrameNavigationEntries. Once we do, this should be a DCHECK. |
| 3629 if (rvh->GetDelegate()->GetAsWebContents() != this) | 3629 if (rvh->GetDelegate()->GetAsWebContents() != this) |
| 3630 return; | 3630 return; |
| 3631 | 3631 |
| 3632 // We must be prepared to handle state updates for any page, these occur | 3632 // We must be prepared to handle state updates for any page, these occur |
| 3633 // when the user is scrolling and entering form data, as well as when we're | 3633 // when the user is scrolling and entering form data, as well as when we're |
| 3634 // leaving a page, in which case our state may have already been moved to | 3634 // leaving a page, in which case our state may have already been moved to |
| 3635 // the next page. The navigation controller will look up the appropriate | 3635 // the next page. The navigation controller will look up the appropriate |
| 3636 // NavigationEntry and update it when it is notified via the delegate. | 3636 // NavigationEntry and update it when it is notified via the delegate. |
| 3637 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( |
| 3638 rvh->GetSiteInstance(), page_id); |
| 3637 | 3639 |
| 3638 int entry_index = controller_.GetEntryIndexWithPageID( | 3640 if (!entry) |
| 3639 rvh->GetSiteInstance(), page_id); | |
| 3640 if (entry_index < 0) | |
| 3641 return; | 3641 return; |
| 3642 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); | |
| 3643 | 3642 |
| 3644 if (page_state == entry->GetPageState()) | 3643 if (page_state == entry->GetPageState()) |
| 3645 return; // Nothing to update. | 3644 return; // Nothing to update. |
| 3646 entry->SetPageState(page_state); | 3645 entry->SetPageState(page_state); |
| 3647 controller_.NotifyEntryChanged(entry, entry_index); | 3646 controller_.NotifyEntryChanged(entry); |
| 3648 } | 3647 } |
| 3649 | 3648 |
| 3650 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, | 3649 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, |
| 3651 const GURL& url) { | 3650 const GURL& url) { |
| 3652 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { | 3651 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { |
| 3653 // If we're fullscreen only update the url if it's from the fullscreen | 3652 // If we're fullscreen only update the url if it's from the fullscreen |
| 3654 // renderer. | 3653 // renderer. |
| 3655 RenderWidgetHostView* fs = GetFullscreenRenderWidgetHostView(); | 3654 RenderWidgetHostView* fs = GetFullscreenRenderWidgetHostView(); |
| 3656 if (fs && fs->GetRenderWidgetHost() != render_view_host) | 3655 if (fs && fs->GetRenderWidgetHost() != render_view_host) |
| 3657 return; | 3656 return; |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4389 player_map->erase(it); | 4388 player_map->erase(it); |
| 4390 } | 4389 } |
| 4391 | 4390 |
| 4392 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4391 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4393 force_disable_overscroll_content_ = force_disable; | 4392 force_disable_overscroll_content_ = force_disable; |
| 4394 if (view_) | 4393 if (view_) |
| 4395 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4394 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4396 } | 4395 } |
| 4397 | 4396 |
| 4398 } // namespace content | 4397 } // namespace content |
| OLD | NEW |