| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/arc/ime/arc_ime_bridge_impl.h" | 5 #include "components/arc/ime/arc_ime_bridge_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> |
| 8 | 9 |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "components/arc/arc_bridge_service.h" | 12 #include "components/arc/arc_bridge_service.h" |
| 12 #include "ui/base/ime/composition_text.h" | 13 #include "ui/base/ime/composition_text.h" |
| 13 #include "ui/base/ime/text_input_type.h" | 14 #include "ui/base/ime/text_input_type.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 15 | 16 |
| 16 namespace arc { | 17 namespace arc { |
| 17 namespace { | 18 namespace { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 return ui::TEXT_INPUT_TYPE_DATE; | 50 return ui::TEXT_INPUT_TYPE_DATE; |
| 50 case mojom::TextInputType::TIME: | 51 case mojom::TextInputType::TIME: |
| 51 return ui::TEXT_INPUT_TYPE_TIME; | 52 return ui::TEXT_INPUT_TYPE_TIME; |
| 52 case mojom::TextInputType::DATETIME: | 53 case mojom::TextInputType::DATETIME: |
| 53 return ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL; | 54 return ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL; |
| 54 default: | 55 default: |
| 55 return ui::TEXT_INPUT_TYPE_TEXT; | 56 return ui::TEXT_INPUT_TYPE_TEXT; |
| 56 } | 57 } |
| 57 } | 58 } |
| 58 | 59 |
| 59 mojo::Array<mojom::CompositionSegmentPtr> ConvertSegments( | 60 std::vector<mojom::CompositionSegmentPtr> ConvertSegments( |
| 60 const ui::CompositionText& composition) { | 61 const ui::CompositionText& composition) { |
| 61 mojo::Array<mojom::CompositionSegmentPtr> segments = | 62 std::vector<mojom::CompositionSegmentPtr> segments; |
| 62 mojo::Array<mojom::CompositionSegmentPtr>::New(0); | |
| 63 for (const ui::CompositionUnderline& underline : composition.underlines) { | 63 for (const ui::CompositionUnderline& underline : composition.underlines) { |
| 64 mojom::CompositionSegmentPtr segment = mojom::CompositionSegment::New(); | 64 mojom::CompositionSegmentPtr segment = mojom::CompositionSegment::New(); |
| 65 segment->start_offset = underline.start_offset; | 65 segment->start_offset = underline.start_offset; |
| 66 segment->end_offset = underline.end_offset; | 66 segment->end_offset = underline.end_offset; |
| 67 segment->emphasized = | 67 segment->emphasized = |
| 68 (underline.thick || | 68 (underline.thick || |
| 69 (composition.selection.start() == underline.start_offset && | 69 (composition.selection.start() == underline.start_offset && |
| 70 composition.selection.end() == underline.end_offset)); | 70 composition.selection.end() == underline.end_offset)); |
| 71 segments.push_back(std::move(segment)); | 71 segments.push_back(std::move(segment)); |
| 72 } | 72 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 void ArcImeBridgeImpl::OnCancelComposition() { | 153 void ArcImeBridgeImpl::OnCancelComposition() { |
| 154 delegate_->OnCancelComposition(); | 154 delegate_->OnCancelComposition(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void ArcImeBridgeImpl::ShowImeIfNeeded() { | 157 void ArcImeBridgeImpl::ShowImeIfNeeded() { |
| 158 delegate_->ShowImeIfNeeded(); | 158 delegate_->ShowImeIfNeeded(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace arc | 161 } // namespace arc |
| OLD | NEW |