blob: c3dcacd6c90f3aaef2031e647168d71b29c733f6 (
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
|
// Copyright 2013 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 WIN8_METRO_DRIVER_IME_TEXT_SERVICE_H_
#define WIN8_METRO_DRIVER_IME_TEXT_SERVICE_H_
#include <windows.h>
#include <stdint.h>
#include <vector>
#include "base/memory/scoped_ptr.h"
namespace metro_viewer {
struct CharacterBounds;
}
namespace metro_driver {
class TextServiceDelegate;
// An interface to manage a virtual text store with which an IME communicates.
class TextService {
public:
virtual ~TextService() {}
// Cancels on-going composition. Does nothing if there is no composition.
virtual void CancelComposition() = 0;
// Updates document type with |input_scopes| and caret/composition position
// with |character_bounds|. An empty |input_scopes| indicates that IMEs
// should be disabled until non-empty |input_scopes| is specified.
// Note: |input_scopes| is defined as std::vector<int32_t> here rather than
// std::vector<InputScope> because the wire format of IPC message
// MetroViewerHostMsg_ImeTextInputClientUpdated uses std::vector<int32_t> to
// avoid dependency on <InputScope.h> header.
virtual void OnDocumentChanged(
const std::vector<int32_t>& input_scopes,
const std::vector<metro_viewer::CharacterBounds>& character_bounds) = 0;
// Must be called whenever the attached window gains keyboard focus.
virtual void OnWindowActivated() = 0;
};
// Returns an instance of TextService that works together with
// |text_store_delegate| as if it was an text area owned by |window_handle|.
scoped_ptr<TextService>
CreateTextService(TextServiceDelegate* delegate, HWND window_handle);
} // namespace metro_driver
#endif // WIN8_METRO_DRIVER_IME_TEXT_SERVICE_H_
|