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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 903143003: wip: Touch Text Selection Prototypes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@selection_granularity_on_unified
Patch Set: Created 5 years, 10 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
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index b821a9f8d7ddfbcb9963e21ffa724b51f7a5ba47..09803ee7f6e391d1be2041adf1be53492ecae289 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2373,8 +2373,28 @@ void RenderWidgetHostViewAura::InitSelectionController(
ui::TouchSelectionControllerAuraClient* selection_controller_client) {
DCHECK(!selection_controller_client_);
selection_controller_client_.reset(selection_controller_client);
+ ui::TextSelectionGranularityStrategy strategy =
+ ui::GRANULARITY_STRATEGY_DEFAULT;
+ const std::string strategy_str = base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII(switches::kTouchTextSelectionStrategy);
+ if (strategy_str == "1")
+ strategy = ui::GRANULARITY_STRATEGY_DIRECTION;
+ else if (strategy_str == "2")
+ strategy = ui::GRANULARITY_STRATEGY_VELOCITY;
selection_controller_.reset(
- new ui::TouchSelectionControllerAura(selection_controller_client));
+ new ui::TouchSelectionControllerAura(selection_controller_client,
+ strategy));
+ const std::string decay_str = base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII(switches::kTouchTextSelectionHalfDecay);
+ const std::string threshold_str = base::CommandLine::ForCurrentProcess()->
+ GetSwitchValueASCII(switches::kTouchTextSelectionThreshold);
+ if (!decay_str.empty() && !threshold_str.empty()) {
+ int decay_ms = atoi(decay_str.c_str());
+ int threshold = atoi(threshold_str.c_str());
+ if (decay_ms && threshold)
+ selection_controller_->SetVelocityStrategyParameters(decay_ms, threshold);
+ }
+
}
void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698