blob: a71fdba2483571247794afb9409eef6af202f3c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_
#define COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_
#include <string>
#include "base/macros.h"
#include "base/strings/string16.h"
#include "components/arc/common/ime.mojom.h"
#include "components/arc/ime/arc_ime_bridge.h"
#include "ui/base/ime/text_input_type.h"
#include "ui/gfx/geometry/rect.h"
namespace ui {
struct CompositionText;
} // namespace ui
namespace arc {
class ArcBridgeService;
// This class encapsulates the detail of IME related IPC between
// Chromium and the ARC container.
class ArcImeBridgeImpl : public ArcImeBridge, public mojom::ImeHost {
public:
ArcImeBridgeImpl(Delegate* delegate, ArcBridgeService* bridge_service);
~ArcImeBridgeImpl() override;
// ArcImeBridge overrides:
void SendSetCompositionText(const ui::CompositionText& composition) override;
void SendConfirmCompositionText() override;
void SendInsertText(const base::string16& text) override;
void SendExtendSelectionAndDelete(size_t before, size_t after) override;
void SendOnKeyboardAppearanceChanging(const gfx::Rect& new_bounds,
bool is_available) override;
// mojom::ImeHost overrides:
void OnTextInputTypeChanged(mojom::TextInputType type) override;
void OnCursorRectChanged(const gfx::Rect& rect,
bool screen_coordinates) override;
void OnCancelComposition() override;
void ShowImeIfNeeded() override;
void OnCursorRectChangedWithSurroundingText(const gfx::Rect& rect,
const gfx::Range& text_range,
const std::string& text_in_range,
const gfx::Range& selection_range,
bool screen_coordinates) override;
private:
Delegate* const delegate_;
ArcBridgeService* const bridge_service_;
DISALLOW_COPY_AND_ASSIGN(ArcImeBridgeImpl);
};
} // namespace arc
#endif // COMPONENTS_ARC_IME_ARC_IME_BRIDGE_IMPL_H_
|