Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 16162003: Introduce content::PageState (again). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1978 return; 1978 return;
1979 1979
1980 NavigationEntry* active_entry = GetController().GetActiveEntry(); 1980 NavigationEntry* active_entry = GetController().GetActiveEntry();
1981 if (!active_entry) 1981 if (!active_entry)
1982 return; 1982 return;
1983 1983
1984 delegate_->ViewSourceForTab(this, active_entry->GetURL()); 1984 delegate_->ViewSourceForTab(this, active_entry->GetURL());
1985 } 1985 }
1986 1986
1987 void WebContentsImpl::ViewFrameSource(const GURL& url, 1987 void WebContentsImpl::ViewFrameSource(const GURL& url,
1988 const std::string& content_state) { 1988 const PageState& page_state) {
1989 if (!delegate_) 1989 if (!delegate_)
1990 return; 1990 return;
1991 1991
1992 delegate_->ViewSourceForFrame(this, url, content_state); 1992 delegate_->ViewSourceForFrame(this, url, page_state);
1993 } 1993 }
1994 1994
1995 int WebContentsImpl::GetMinimumZoomPercent() const { 1995 int WebContentsImpl::GetMinimumZoomPercent() const {
1996 return minimum_zoom_percent_; 1996 return minimum_zoom_percent_;
1997 } 1997 }
1998 1998
1999 int WebContentsImpl::GetMaximumZoomPercent() const { 1999 int WebContentsImpl::GetMaximumZoomPercent() const {
2000 return maximum_zoom_percent_; 2000 return maximum_zoom_percent_;
2001 } 2001 }
2002 2002
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
2895 if (delegate_) { 2895 if (delegate_) {
2896 delegate_->DidNavigateMainFramePostCommit(this); 2896 delegate_->DidNavigateMainFramePostCommit(this);
2897 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); 2897 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent());
2898 } 2898 }
2899 } 2899 }
2900 DidNavigateAnyFramePostCommit(rvh, details, params); 2900 DidNavigateAnyFramePostCommit(rvh, details, params);
2901 } 2901 }
2902 2902
2903 void WebContentsImpl::UpdateState(RenderViewHost* rvh, 2903 void WebContentsImpl::UpdateState(RenderViewHost* rvh,
2904 int32 page_id, 2904 int32 page_id,
2905 const std::string& state) { 2905 const PageState& page_state) {
2906 // Ensure that this state update comes from either the active RVH or one of 2906 // Ensure that this state update comes from either the active RVH or one of
2907 // the swapped out RVHs. We don't expect to hear from any other RVHs. 2907 // the swapped out RVHs. We don't expect to hear from any other RVHs.
2908 DCHECK(rvh == GetRenderViewHost() || render_manager_.IsOnSwappedOutList(rvh)); 2908 DCHECK(rvh == GetRenderViewHost() || render_manager_.IsOnSwappedOutList(rvh));
2909 2909
2910 // We must be prepared to handle state updates for any page, these occur 2910 // We must be prepared to handle state updates for any page, these occur
2911 // when the user is scrolling and entering form data, as well as when we're 2911 // when the user is scrolling and entering form data, as well as when we're
2912 // leaving a page, in which case our state may have already been moved to 2912 // leaving a page, in which case our state may have already been moved to
2913 // the next page. The navigation controller will look up the appropriate 2913 // the next page. The navigation controller will look up the appropriate
2914 // NavigationEntry and update it when it is notified via the delegate. 2914 // NavigationEntry and update it when it is notified via the delegate.
2915 2915
2916 int entry_index = controller_.GetEntryIndexWithPageID( 2916 int entry_index = controller_.GetEntryIndexWithPageID(
2917 rvh->GetSiteInstance(), page_id); 2917 rvh->GetSiteInstance(), page_id);
2918 if (entry_index < 0) 2918 if (entry_index < 0)
2919 return; 2919 return;
2920 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); 2920 NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index);
2921 2921
2922 if (state == entry->GetContentState()) 2922 if (page_state == entry->GetPageState())
2923 return; // Nothing to update. 2923 return; // Nothing to update.
2924 entry->SetContentState(state); 2924 entry->SetPageState(page_state);
2925 controller_.NotifyEntryChanged(entry, entry_index); 2925 controller_.NotifyEntryChanged(entry, entry_index);
2926 } 2926 }
2927 2927
2928 void WebContentsImpl::UpdateTitle(RenderViewHost* rvh, 2928 void WebContentsImpl::UpdateTitle(RenderViewHost* rvh,
2929 int32 page_id, 2929 int32 page_id,
2930 const string16& title, 2930 const string16& title,
2931 base::i18n::TextDirection title_direction) { 2931 base::i18n::TextDirection title_direction) {
2932 // If we have a title, that's a pretty good indication that we've started 2932 // If we have a title, that's a pretty good indication that we've started
2933 // getting useful data. 2933 // getting useful data.
2934 SetNotWaitingForResponse(); 2934 SetNotWaitingForResponse();
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
3575 } 3575 }
3576 3576
3577 BrowserPluginGuestManager* 3577 BrowserPluginGuestManager*
3578 WebContentsImpl::GetBrowserPluginGuestManager() const { 3578 WebContentsImpl::GetBrowserPluginGuestManager() const {
3579 return static_cast<BrowserPluginGuestManager*>( 3579 return static_cast<BrowserPluginGuestManager*>(
3580 GetBrowserContext()->GetUserData( 3580 GetBrowserContext()->GetUserData(
3581 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3581 browser_plugin::kBrowserPluginGuestManagerKeyName));
3582 } 3582 }
3583 3583
3584 } // namespace content 3584 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698