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 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 return; | 1933 return; |
1934 | 1934 |
1935 NavigationEntry* active_entry = GetController().GetActiveEntry(); | 1935 NavigationEntry* active_entry = GetController().GetActiveEntry(); |
1936 if (!active_entry) | 1936 if (!active_entry) |
1937 return; | 1937 return; |
1938 | 1938 |
1939 delegate_->ViewSourceForTab(this, active_entry->GetURL()); | 1939 delegate_->ViewSourceForTab(this, active_entry->GetURL()); |
1940 } | 1940 } |
1941 | 1941 |
1942 void WebContentsImpl::ViewFrameSource(const GURL& url, | 1942 void WebContentsImpl::ViewFrameSource(const GURL& url, |
1943 const std::string& content_state) { | 1943 const PageState& page_state) { |
1944 if (!delegate_) | 1944 if (!delegate_) |
1945 return; | 1945 return; |
1946 | 1946 |
1947 delegate_->ViewSourceForFrame(this, url, content_state); | 1947 delegate_->ViewSourceForFrame(this, url, page_state); |
1948 } | 1948 } |
1949 | 1949 |
1950 int WebContentsImpl::GetMinimumZoomPercent() const { | 1950 int WebContentsImpl::GetMinimumZoomPercent() const { |
1951 return minimum_zoom_percent_; | 1951 return minimum_zoom_percent_; |
1952 } | 1952 } |
1953 | 1953 |
1954 int WebContentsImpl::GetMaximumZoomPercent() const { | 1954 int WebContentsImpl::GetMaximumZoomPercent() const { |
1955 return maximum_zoom_percent_; | 1955 return maximum_zoom_percent_; |
1956 } | 1956 } |
1957 | 1957 |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 if (delegate_) { | 2842 if (delegate_) { |
2843 delegate_->DidNavigateMainFramePostCommit(this); | 2843 delegate_->DidNavigateMainFramePostCommit(this); |
2844 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); | 2844 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); |
2845 } | 2845 } |
2846 } | 2846 } |
2847 DidNavigateAnyFramePostCommit(rvh, details, params); | 2847 DidNavigateAnyFramePostCommit(rvh, details, params); |
2848 } | 2848 } |
2849 | 2849 |
2850 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | 2850 void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
2851 int32 page_id, | 2851 int32 page_id, |
2852 const std::string& state) { | 2852 const PageState& page_state) { |
2853 // Ensure that this state update comes from either the active RVH or one of | 2853 // Ensure that this state update comes from either the active RVH or one of |
2854 // the swapped out RVHs. We don't expect to hear from any other RVHs. | 2854 // the swapped out RVHs. We don't expect to hear from any other RVHs. |
2855 DCHECK(rvh == GetRenderViewHost() || render_manager_.IsOnSwappedOutList(rvh)); | 2855 DCHECK(rvh == GetRenderViewHost() || render_manager_.IsOnSwappedOutList(rvh)); |
2856 | 2856 |
2857 // We must be prepared to handle state updates for any page, these occur | 2857 // We must be prepared to handle state updates for any page, these occur |
2858 // when the user is scrolling and entering form data, as well as when we're | 2858 // when the user is scrolling and entering form data, as well as when we're |
2859 // leaving a page, in which case our state may have already been moved to | 2859 // leaving a page, in which case our state may have already been moved to |
2860 // the next page. The navigation controller will look up the appropriate | 2860 // the next page. The navigation controller will look up the appropriate |
2861 // NavigationEntry and update it when it is notified via the delegate. | 2861 // NavigationEntry and update it when it is notified via the delegate. |
2862 | 2862 |
2863 int entry_index = controller_.GetEntryIndexWithPageID( | 2863 int entry_index = controller_.GetEntryIndexWithPageID( |
2864 rvh->GetSiteInstance(), page_id); | 2864 rvh->GetSiteInstance(), page_id); |
2865 if (entry_index < 0) | 2865 if (entry_index < 0) |
2866 return; | 2866 return; |
2867 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); | 2867 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); |
2868 | 2868 |
2869 if (state == entry->GetContentState()) | 2869 if (page_state == entry->GetPageState()) |
2870 return; // Nothing to update. | 2870 return; // Nothing to update. |
2871 entry->SetContentState(state); | 2871 entry->SetPageState(page_state); |
2872 controller_.NotifyEntryChanged(entry, entry_index); | 2872 controller_.NotifyEntryChanged(entry, entry_index); |
2873 } | 2873 } |
2874 | 2874 |
2875 void WebContentsImpl::UpdateTitle(RenderViewHost* rvh, | 2875 void WebContentsImpl::UpdateTitle(RenderViewHost* rvh, |
2876 int32 page_id, | 2876 int32 page_id, |
2877 const string16& title, | 2877 const string16& title, |
2878 base::i18n::TextDirection title_direction) { | 2878 base::i18n::TextDirection title_direction) { |
2879 // If we have a title, that's a pretty good indication that we've started | 2879 // If we have a title, that's a pretty good indication that we've started |
2880 // getting useful data. | 2880 // getting useful data. |
2881 SetNotWaitingForResponse(); | 2881 SetNotWaitingForResponse(); |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3523 } | 3523 } |
3524 | 3524 |
3525 BrowserPluginGuestManager* | 3525 BrowserPluginGuestManager* |
3526 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3526 WebContentsImpl::GetBrowserPluginGuestManager() const { |
3527 return static_cast<BrowserPluginGuestManager*>( | 3527 return static_cast<BrowserPluginGuestManager*>( |
3528 GetBrowserContext()->GetUserData( | 3528 GetBrowserContext()->GetUserData( |
3529 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3529 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
3530 } | 3530 } |
3531 | 3531 |
3532 } // namespace content | 3532 } // namespace content |
OLD | NEW |