touch_selection_controller_test_api.cc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright 2015 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/touch_selection/touch_selection_controller_test_api.h"
  5. namespace ui {
  6. TouchSelectionControllerTestApi::TouchSelectionControllerTestApi(
  7. TouchSelectionController* controller)
  8. : controller_(controller) {}
  9. TouchSelectionControllerTestApi::~TouchSelectionControllerTestApi() {}
  10. bool TouchSelectionControllerTestApi::GetStartVisible() const {
  11. return controller_->GetStartVisible();
  12. }
  13. bool TouchSelectionControllerTestApi::GetEndVisible() const {
  14. return controller_->GetEndVisible();
  15. }
  16. float TouchSelectionControllerTestApi::GetStartAlpha() const {
  17. if (controller_->active_status_ == TouchSelectionController::SELECTION_ACTIVE)
  18. return controller_->start_selection_handle_->alpha();
  19. return 0.f;
  20. }
  21. float TouchSelectionControllerTestApi::GetEndAlpha() const {
  22. if (controller_->active_status_ == TouchSelectionController::SELECTION_ACTIVE)
  23. return controller_->end_selection_handle_->alpha();
  24. return 0.f;
  25. }
  26. float TouchSelectionControllerTestApi::GetInsertionHandleAlpha() const {
  27. if (controller_->active_status_ == TouchSelectionController::INSERTION_ACTIVE)
  28. return controller_->insertion_handle_->alpha();
  29. return 0.f;
  30. }
  31. TouchHandleOrientation
  32. TouchSelectionControllerTestApi::GetStartHandleOrientation() const {
  33. if (controller_->active_status_ != TouchSelectionController::SELECTION_ACTIVE)
  34. return TouchHandleOrientation::UNDEFINED;
  35. return controller_->start_selection_handle_->orientation();
  36. }
  37. TouchHandleOrientation
  38. TouchSelectionControllerTestApi::GetEndHandleOrientation() const {
  39. if (controller_->active_status_ != TouchSelectionController::SELECTION_ACTIVE)
  40. return TouchHandleOrientation::UNDEFINED;
  41. return controller_->end_selection_handle_->orientation();
  42. }
  43. } // namespace ui