| OLD | NEW |
| (Empty) | |
| 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 |
| 5 #include "content/browser/renderer_host/ui_touch_selection_helper.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "cc/output/viewport_selection_bound.h" |
| 9 #include "ui/base/touch/selection_bound.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 namespace { |
| 14 |
| 15 ui::SelectionBound::Type ConvertSelectionBoundType( |
| 16 cc::SelectionBoundType type) { |
| 17 switch (type) { |
| 18 case cc::SELECTION_BOUND_LEFT: |
| 19 return ui::SelectionBound::LEFT; |
| 20 case cc::SELECTION_BOUND_RIGHT: |
| 21 return ui::SelectionBound::RIGHT; |
| 22 case cc::SELECTION_BOUND_CENTER: |
| 23 return ui::SelectionBound::CENTER; |
| 24 case cc::SELECTION_BOUND_EMPTY: |
| 25 return ui::SelectionBound::EMPTY; |
| 26 } |
| 27 NOTREACHED() << "Unknown selection bound type"; |
| 28 return ui::SelectionBound::EMPTY; |
| 29 } |
| 30 |
| 31 } // namespace |
| 32 |
| 33 ui::SelectionBound ConvertSelectionBound( |
| 34 const cc::ViewportSelectionBound& bound) { |
| 35 ui::SelectionBound ui_bound; |
| 36 ui_bound.set_type(ConvertSelectionBoundType(bound.type)); |
| 37 ui_bound.set_visible(bound.visible); |
| 38 if (ui_bound.type() != ui::SelectionBound::EMPTY) |
| 39 ui_bound.SetEdge(bound.edge_top, bound.edge_bottom); |
| 40 return ui_bound; |
| 41 } |
| 42 |
| 43 } // namespace content |
| OLD | NEW |