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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 313083002: Disable overscroll navigation when emulating touch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 1df288a3b8809c23c804c7260e833cecb33d8b94..6656462cdacded576ac97870b1ab87c6f1ea4c60 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -347,6 +347,7 @@ WebContentsImpl::WebContentsImpl(
render_view_message_source_(NULL),
fullscreen_widget_routing_id_(MSG_ROUTING_NONE),
is_subframe_(false),
+ touch_emulation_enabled_(false),
last_dialog_suppressed_(false) {
for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
g_created_callbacks.Get().at(i).Run(this);
@@ -613,7 +614,7 @@ void WebContentsImpl::SetDelegate(WebContentsDelegate* delegate) {
delegate_->Attach(this);
// Ensure the visible RVH reflects the new delegate's preferences.
if (view_)
- view_->SetOverscrollControllerEnabled(delegate->CanOverscrollContent());
+ view_->SetOverscrollControllerEnabled(CanOverscrollContent());
}
}
@@ -1698,6 +1699,12 @@ void WebContentsImpl::DidSendScreenRects(RenderWidgetHostImpl* rwh) {
browser_plugin_embedder_->DidSendScreenRects();
}
+void WebContentsImpl::OnTouchEmulationEnabled(bool enabled) {
+ touch_emulation_enabled_ = enabled;
+ if (view_)
+ view_->SetOverscrollControllerEnabled(CanOverscrollContent());
+}
+
void WebContentsImpl::UpdatePreferredSize(const gfx::Size& pref_size) {
const gfx::Size old_size = GetPreferredSize();
preferred_size_ = pref_size;
@@ -2456,10 +2463,9 @@ void WebContentsImpl::DidNavigateMainFramePostCommit(
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
DidNavigateMainFrame(details, params));
- if (delegate_) {
+ if (delegate_)
delegate_->DidNavigateMainFramePostCommit(this);
- view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent());
- }
+ view_->SetOverscrollControllerEnabled(CanOverscrollContent());
}
void WebContentsImpl::DidNavigateAnyFramePostCommit(
@@ -2484,6 +2490,10 @@ void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) {
}
bool WebContentsImpl::CanOverscrollContent() const {
+ // Disable overscroll when touch emulation is on. See crbug.com/369938.
+ if (touch_emulation_enabled_)
+ return false;
+
if (delegate_)
return delegate_->CanOverscrollContent();
@@ -3295,7 +3305,7 @@ void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) {
return;
if (delegate_)
- view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent());
+ view_->SetOverscrollControllerEnabled(CanOverscrollContent());
NotificationService::current()->Notify(
NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
@@ -3797,7 +3807,7 @@ void WebContentsImpl::NotifySwappedFromRenderManager(RenderViewHost* old_host,
// Make sure the visible RVH reflects the new delegate's preferences.
if (delegate_)
- view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent());
+ view_->SetOverscrollControllerEnabled(CanOverscrollContent());
view_->RenderViewSwappedIn(new_host);
}
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698