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

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

Issue 474213002: DevTools: control touch emulation from the browser side only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaselined Created 6 years, 4 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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 last_active_time_(base::TimeTicks::Now()), 366 last_active_time_(base::TimeTicks::Now()),
367 closed_by_user_gesture_(false), 367 closed_by_user_gesture_(false),
368 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), 368 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)),
369 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), 369 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)),
370 totalPinchGestureAmount_(0), 370 totalPinchGestureAmount_(0),
371 currentPinchZoomStepDelta_(0), 371 currentPinchZoomStepDelta_(0),
372 render_view_message_source_(NULL), 372 render_view_message_source_(NULL),
373 fullscreen_widget_routing_id_(MSG_ROUTING_NONE), 373 fullscreen_widget_routing_id_(MSG_ROUTING_NONE),
374 fullscreen_widget_had_focus_at_shutdown_(false), 374 fullscreen_widget_had_focus_at_shutdown_(false),
375 is_subframe_(false), 375 is_subframe_(false),
376 touch_emulation_enabled_(false), 376 force_disable_overscroll_content_(false),
377 last_dialog_suppressed_(false), 377 last_dialog_suppressed_(false),
378 accessibility_mode_( 378 accessibility_mode_(
379 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()) { 379 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()) {
380 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) 380 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
381 g_created_callbacks.Get().at(i).Run(this); 381 g_created_callbacks.Get().at(i).Run(this);
382 frame_tree_.SetFrameRemoveListener( 382 frame_tree_.SetFrameRemoveListener(
383 base::Bind(&WebContentsImpl::OnFrameRemoved, 383 base::Bind(&WebContentsImpl::OnFrameRemoved,
384 base::Unretained(this))); 384 base::Unretained(this)));
385 } 385 }
386 386
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 const gfx::Rect& anchor_in_root_view) { 1790 const gfx::Rect& anchor_in_root_view) {
1791 if (delegate_) 1791 if (delegate_)
1792 delegate_->MoveValidationMessage(this, anchor_in_root_view); 1792 delegate_->MoveValidationMessage(this, anchor_in_root_view);
1793 } 1793 }
1794 1794
1795 void WebContentsImpl::DidSendScreenRects(RenderWidgetHostImpl* rwh) { 1795 void WebContentsImpl::DidSendScreenRects(RenderWidgetHostImpl* rwh) {
1796 if (browser_plugin_embedder_) 1796 if (browser_plugin_embedder_)
1797 browser_plugin_embedder_->DidSendScreenRects(); 1797 browser_plugin_embedder_->DidSendScreenRects();
1798 } 1798 }
1799 1799
1800 void WebContentsImpl::OnTouchEmulationEnabled(bool enabled) {
1801 touch_emulation_enabled_ = enabled;
1802 if (view_)
1803 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
1804 }
1805
1806 BrowserAccessibilityManager* 1800 BrowserAccessibilityManager*
1807 WebContentsImpl::GetRootBrowserAccessibilityManager() { 1801 WebContentsImpl::GetRootBrowserAccessibilityManager() {
1808 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame()); 1802 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame());
1809 return rfh ? rfh->browser_accessibility_manager() : NULL; 1803 return rfh ? rfh->browser_accessibility_manager() : NULL;
1810 } 1804 }
1811 1805
1812 BrowserAccessibilityManager* 1806 BrowserAccessibilityManager*
1813 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() { 1807 WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() {
1814 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame()); 1808 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(GetMainFrame());
1815 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : NULL; 1809 return rfh ? rfh->GetOrCreateBrowserAccessibilityManager() : NULL;
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2582 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
2589 DidNavigateAnyFrame(details, params)); 2583 DidNavigateAnyFrame(details, params));
2590 } 2584 }
2591 2585
2592 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { 2586 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) {
2593 contents_mime_type_ = mime_type; 2587 contents_mime_type_ = mime_type;
2594 } 2588 }
2595 2589
2596 bool WebContentsImpl::CanOverscrollContent() const { 2590 bool WebContentsImpl::CanOverscrollContent() const {
2597 // Disable overscroll when touch emulation is on. See crbug.com/369938. 2591 // Disable overscroll when touch emulation is on. See crbug.com/369938.
2598 if (touch_emulation_enabled_) 2592 if (force_disable_overscroll_content_)
2599 return false; 2593 return false;
2600 2594
2601 if (delegate_) 2595 if (delegate_)
2602 return delegate_->CanOverscrollContent(); 2596 return delegate_->CanOverscrollContent();
2603 2597
2604 return false; 2598 return false;
2605 } 2599 }
2606 2600
2607 void WebContentsImpl::OnThemeColorChanged(SkColor theme_color) { 2601 void WebContentsImpl::OnThemeColorChanged(SkColor theme_color) {
2608 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 2602 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
4245 const gfx::Size new_size = GetPreferredSize(); 4239 const gfx::Size new_size = GetPreferredSize();
4246 if (new_size != old_size) 4240 if (new_size != old_size)
4247 delegate_->UpdatePreferredSize(this, new_size); 4241 delegate_->UpdatePreferredSize(this, new_size);
4248 } 4242 }
4249 4243
4250 void WebContentsImpl::ResumeResponseDeferredAtStart() { 4244 void WebContentsImpl::ResumeResponseDeferredAtStart() {
4251 FrameTreeNode* node = frame_tree_.root(); 4245 FrameTreeNode* node = frame_tree_.root();
4252 node->render_manager()->ResumeResponseDeferredAtStart(); 4246 node->render_manager()->ResumeResponseDeferredAtStart();
4253 } 4247 }
4254 4248
4249 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4250 force_disable_overscroll_content_ = force_disable;
4251 if (view_)
4252 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4253 }
4254
4255 } // namespace content 4255 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698