| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 params->current_history_list_offset = | 210 params->current_history_list_offset = |
| 211 controller.GetLastCommittedEntryIndex(); | 211 controller.GetLastCommittedEntryIndex(); |
| 212 params->current_history_list_length = controller.GetEntryCount(); | 212 params->current_history_list_length = controller.GetEntryCount(); |
| 213 } | 213 } |
| 214 if (!entry.GetBaseURLForDataURL().is_empty()) { | 214 if (!entry.GetBaseURLForDataURL().is_empty()) { |
| 215 params->base_url_for_data_url = entry.GetBaseURLForDataURL(); | 215 params->base_url_for_data_url = entry.GetBaseURLForDataURL(); |
| 216 params->history_url_for_data_url = entry.GetVirtualURL(); | 216 params->history_url_for_data_url = entry.GetVirtualURL(); |
| 217 } | 217 } |
| 218 params->referrer = entry.GetReferrer(); | 218 params->referrer = entry.GetReferrer(); |
| 219 params->transition = entry.GetTransitionType(); | 219 params->transition = entry.GetTransitionType(); |
| 220 params->state = entry.GetContentState(); | 220 params->page_state = entry.GetPageState(); |
| 221 params->navigation_type = | 221 params->navigation_type = |
| 222 GetNavigationType(controller.GetBrowserContext(), entry, reload_type); | 222 GetNavigationType(controller.GetBrowserContext(), entry, reload_type); |
| 223 params->request_time = base::Time::Now(); | 223 params->request_time = base::Time::Now(); |
| 224 params->extra_headers = entry.extra_headers(); | 224 params->extra_headers = entry.extra_headers(); |
| 225 params->transferred_request_child_id = | 225 params->transferred_request_child_id = |
| 226 entry.transferred_global_request_id().child_id; | 226 entry.transferred_global_request_id().child_id; |
| 227 params->transferred_request_request_id = | 227 params->transferred_request_request_id = |
| 228 entry.transferred_global_request_id().request_id; | 228 entry.transferred_global_request_id().request_id; |
| 229 params->is_overriding_user_agent = entry.GetIsOverridingUserAgent(); | 229 params->is_overriding_user_agent = entry.GetIsOverridingUserAgent(); |
| 230 // Avoid downloading when in view-source mode. | 230 // Avoid downloading when in view-source mode. |
| (...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 return; | 1977 return; |
| 1978 | 1978 |
| 1979 NavigationEntry* active_entry = GetController().GetActiveEntry(); | 1979 NavigationEntry* active_entry = GetController().GetActiveEntry(); |
| 1980 if (!active_entry) | 1980 if (!active_entry) |
| 1981 return; | 1981 return; |
| 1982 | 1982 |
| 1983 delegate_->ViewSourceForTab(this, active_entry->GetURL()); | 1983 delegate_->ViewSourceForTab(this, active_entry->GetURL()); |
| 1984 } | 1984 } |
| 1985 | 1985 |
| 1986 void WebContentsImpl::ViewFrameSource(const GURL& url, | 1986 void WebContentsImpl::ViewFrameSource(const GURL& url, |
| 1987 const std::string& content_state) { | 1987 const PageState& page_state) { |
| 1988 if (!delegate_) | 1988 if (!delegate_) |
| 1989 return; | 1989 return; |
| 1990 | 1990 |
| 1991 delegate_->ViewSourceForFrame(this, url, content_state); | 1991 delegate_->ViewSourceForFrame(this, url, page_state); |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 int WebContentsImpl::GetMinimumZoomPercent() const { | 1994 int WebContentsImpl::GetMinimumZoomPercent() const { |
| 1995 return minimum_zoom_percent_; | 1995 return minimum_zoom_percent_; |
| 1996 } | 1996 } |
| 1997 | 1997 |
| 1998 int WebContentsImpl::GetMaximumZoomPercent() const { | 1998 int WebContentsImpl::GetMaximumZoomPercent() const { |
| 1999 return maximum_zoom_percent_; | 1999 return maximum_zoom_percent_; |
| 2000 } | 2000 } |
| 2001 | 2001 |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2894 if (delegate_) { | 2894 if (delegate_) { |
| 2895 delegate_->DidNavigateMainFramePostCommit(this); | 2895 delegate_->DidNavigateMainFramePostCommit(this); |
| 2896 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); | 2896 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); |
| 2897 } | 2897 } |
| 2898 } | 2898 } |
| 2899 DidNavigateAnyFramePostCommit(rvh, details, params); | 2899 DidNavigateAnyFramePostCommit(rvh, details, params); |
| 2900 } | 2900 } |
| 2901 | 2901 |
| 2902 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | 2902 void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
| 2903 int32 page_id, | 2903 int32 page_id, |
| 2904 const std::string& state) { | 2904 const PageState& page_state) { |
| 2905 // Ensure that this state update comes from either the active RVH or one of | 2905 // Ensure that this state update comes from either the active RVH or one of |
| 2906 // the swapped out RVHs. We don't expect to hear from any other RVHs. | 2906 // the swapped out RVHs. We don't expect to hear from any other RVHs. |
| 2907 DCHECK(rvh == GetRenderViewHost() || render_manager_.IsOnSwappedOutList(rvh)); | 2907 DCHECK(rvh == GetRenderViewHost() || render_manager_.IsOnSwappedOutList(rvh)); |
| 2908 | 2908 |
| 2909 // We must be prepared to handle state updates for any page, these occur | 2909 // We must be prepared to handle state updates for any page, these occur |
| 2910 // when the user is scrolling and entering form data, as well as when we're | 2910 // when the user is scrolling and entering form data, as well as when we're |
| 2911 // leaving a page, in which case our state may have already been moved to | 2911 // leaving a page, in which case our state may have already been moved to |
| 2912 // the next page. The navigation controller will look up the appropriate | 2912 // the next page. The navigation controller will look up the appropriate |
| 2913 // NavigationEntry and update it when it is notified via the delegate. | 2913 // NavigationEntry and update it when it is notified via the delegate. |
| 2914 | 2914 |
| 2915 int entry_index = controller_.GetEntryIndexWithPageID( | 2915 int entry_index = controller_.GetEntryIndexWithPageID( |
| 2916 rvh->GetSiteInstance(), page_id); | 2916 rvh->GetSiteInstance(), page_id); |
| 2917 if (entry_index < 0) | 2917 if (entry_index < 0) |
| 2918 return; | 2918 return; |
| 2919 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); | 2919 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); |
| 2920 | 2920 |
| 2921 if (state == entry->GetContentState()) | 2921 if (page_state == entry->GetPageState()) |
| 2922 return; // Nothing to update. | 2922 return; // Nothing to update. |
| 2923 entry->SetContentState(state); | 2923 entry->SetPageState(page_state); |
| 2924 controller_.NotifyEntryChanged(entry, entry_index); | 2924 controller_.NotifyEntryChanged(entry, entry_index); |
| 2925 } | 2925 } |
| 2926 | 2926 |
| 2927 void WebContentsImpl::UpdateTitle(RenderViewHost* rvh, | 2927 void WebContentsImpl::UpdateTitle(RenderViewHost* rvh, |
| 2928 int32 page_id, | 2928 int32 page_id, |
| 2929 const string16& title, | 2929 const string16& title, |
| 2930 base::i18n::TextDirection title_direction) { | 2930 base::i18n::TextDirection title_direction) { |
| 2931 // If we have a title, that's a pretty good indication that we've started | 2931 // If we have a title, that's a pretty good indication that we've started |
| 2932 // getting useful data. | 2932 // getting useful data. |
| 2933 SetNotWaitingForResponse(); | 2933 SetNotWaitingForResponse(); |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3574 } | 3574 } |
| 3575 | 3575 |
| 3576 BrowserPluginGuestManager* | 3576 BrowserPluginGuestManager* |
| 3577 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3577 WebContentsImpl::GetBrowserPluginGuestManager() const { |
| 3578 return static_cast<BrowserPluginGuestManager*>( | 3578 return static_cast<BrowserPluginGuestManager*>( |
| 3579 GetBrowserContext()->GetUserData( | 3579 GetBrowserContext()->GetUserData( |
| 3580 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3580 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
| 3581 } | 3581 } |
| 3582 | 3582 |
| 3583 } // namespace content | 3583 } // namespace content |
| OLD | NEW |