Add ICU message format support
[chromium-blink-merge.git] / content / browser / renderer_host / input / ui_touch_selection_helper.cc
blobc8a68bce23a87a3792b305749c9b71c310cca526
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.
5 #include "content/browser/renderer_host/input/ui_touch_selection_helper.h"
7 #include "base/logging.h"
8 #include "cc/output/viewport_selection_bound.h"
10 namespace content {
12 namespace {
14 ui::SelectionBound::Type ConvertSelectionBoundType(
15 cc::SelectionBoundType type) {
16 switch (type) {
17 case cc::SELECTION_BOUND_LEFT:
18 return ui::SelectionBound::LEFT;
19 case cc::SELECTION_BOUND_RIGHT:
20 return ui::SelectionBound::RIGHT;
21 case cc::SELECTION_BOUND_CENTER:
22 return ui::SelectionBound::CENTER;
23 case cc::SELECTION_BOUND_EMPTY:
24 return ui::SelectionBound::EMPTY;
26 NOTREACHED() << "Unknown selection bound type";
27 return ui::SelectionBound::EMPTY;
30 } // namespace
32 ui::SelectionBound ConvertSelectionBound(
33 const cc::ViewportSelectionBound& bound) {
34 ui::SelectionBound ui_bound;
35 ui_bound.set_type(ConvertSelectionBoundType(bound.type));
36 ui_bound.set_visible(bound.visible);
37 if (ui_bound.type() != ui::SelectionBound::EMPTY)
38 ui_bound.SetEdge(bound.edge_top, bound.edge_bottom);
39 return ui_bound;
42 } // namespace content