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/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2366 if (!enabled) | 2366 if (!enabled) |
2367 overscroll_controller_.reset(); | 2367 overscroll_controller_.reset(); |
2368 else if (!overscroll_controller_) | 2368 else if (!overscroll_controller_) |
2369 overscroll_controller_.reset(new OverscrollController()); | 2369 overscroll_controller_.reset(new OverscrollController()); |
2370 } | 2370 } |
2371 | 2371 |
2372 void RenderWidgetHostViewAura::InitSelectionController( | 2372 void RenderWidgetHostViewAura::InitSelectionController( |
2373 ui::TouchSelectionControllerAuraClient* selection_controller_client) { | 2373 ui::TouchSelectionControllerAuraClient* selection_controller_client) { |
2374 DCHECK(!selection_controller_client_); | 2374 DCHECK(!selection_controller_client_); |
2375 selection_controller_client_.reset(selection_controller_client); | 2375 selection_controller_client_.reset(selection_controller_client); |
| 2376 ui::TextSelectionGranularityStrategy strategy = |
| 2377 ui::GRANULARITY_STRATEGY_DEFAULT; |
| 2378 const std::string strategy_str = base::CommandLine::ForCurrentProcess()-> |
| 2379 GetSwitchValueASCII(switches::kTouchTextSelectionStrategy); |
| 2380 if (strategy_str == "1") |
| 2381 strategy = ui::GRANULARITY_STRATEGY_DIRECTION; |
| 2382 else if (strategy_str == "2") |
| 2383 strategy = ui::GRANULARITY_STRATEGY_VELOCITY; |
2376 selection_controller_.reset( | 2384 selection_controller_.reset( |
2377 new ui::TouchSelectionControllerAura(selection_controller_client)); | 2385 new ui::TouchSelectionControllerAura(selection_controller_client, |
| 2386 strategy)); |
| 2387 const std::string decay_str = base::CommandLine::ForCurrentProcess()-> |
| 2388 GetSwitchValueASCII(switches::kTouchTextSelectionHalfDecay); |
| 2389 const std::string threshold_str = base::CommandLine::ForCurrentProcess()-> |
| 2390 GetSwitchValueASCII(switches::kTouchTextSelectionThreshold); |
| 2391 if (!decay_str.empty() && !threshold_str.empty()) { |
| 2392 int decay_ms = atoi(decay_str.c_str()); |
| 2393 int threshold = atoi(threshold_str.c_str()); |
| 2394 if (decay_ms && threshold) |
| 2395 selection_controller_->SetVelocityStrategyParameters(decay_ms, threshold); |
| 2396 } |
| 2397 |
2378 } | 2398 } |
2379 | 2399 |
2380 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { | 2400 void RenderWidgetHostViewAura::SnapToPhysicalPixelBoundary() { |
2381 // The top left corner of our view in window coordinates might not land on a | 2401 // The top left corner of our view in window coordinates might not land on a |
2382 // device pixel boundary if we have a non-integer device scale. In that case, | 2402 // device pixel boundary if we have a non-integer device scale. In that case, |
2383 // to avoid the web contents area looking blurry we translate the web contents | 2403 // to avoid the web contents area looking blurry we translate the web contents |
2384 // in the +x, +y direction to land on the nearest pixel boundary. This may | 2404 // in the +x, +y direction to land on the nearest pixel boundary. This may |
2385 // cause the bottom and right edges to be clipped slightly, but that's ok. | 2405 // cause the bottom and right edges to be clipped slightly, but that's ok. |
2386 aura::Window* snapped = NULL; | 2406 aura::Window* snapped = NULL; |
2387 // On desktop, use the root window. On alternative environment (ash), | 2407 // On desktop, use the root window. On alternative environment (ash), |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2632 | 2652 |
2633 //////////////////////////////////////////////////////////////////////////////// | 2653 //////////////////////////////////////////////////////////////////////////////// |
2634 // RenderWidgetHostViewBase, public: | 2654 // RenderWidgetHostViewBase, public: |
2635 | 2655 |
2636 // static | 2656 // static |
2637 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2657 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2638 GetScreenInfoForWindow(results, NULL); | 2658 GetScreenInfoForWindow(results, NULL); |
2639 } | 2659 } |
2640 | 2660 |
2641 } // namespace content | 2661 } // namespace content |
OLD | NEW |