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