Update path of checkdeps to buildtools checkout
[chromium-blink-merge.git] / win8 / metro_driver / ime / text_service.h
blob6ddd21f3ccb77bec09f835b585d39676a87d25b4
1 // Copyright 2013 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 #ifndef WIN8_METRO_DRIVER_IME_TEXT_SERVICE_H_
6 #define WIN8_METRO_DRIVER_IME_TEXT_SERVICE_H_
8 #include <Windows.h>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h"
15 namespace metro_viewer {
16 struct CharacterBounds;
19 namespace metro_driver {
21 class TextServiceDelegate;
23 // An interface to manage a virtual text store with which an IME communicates.
24 class TextService {
25 public:
26 virtual ~TextService() {}
28 // Cancels on-going composition. Does nothing if there is no composition.
29 virtual void CancelComposition() = 0;
31 // Updates document type with |input_scopes| and caret/composition position
32 // with |character_bounds|. An empty |input_scopes| indicates that IMEs
33 // should be disabled until non-empty |input_scopes| is specified.
34 // Note: |input_scopes| is defined as std::vector<int32> here rather than
35 // std::vector<InputScope> because the wire format of IPC message
36 // MetroViewerHostMsg_ImeTextInputClientUpdated uses std::vector<int32> to
37 // avoid dependency on <InputScope.h> header.
38 virtual void OnDocumentChanged(
39 const std::vector<int32>& input_scopes,
40 const std::vector<metro_viewer::CharacterBounds>& character_bounds) = 0;
42 // Must be called whenever the attached window gains keyboard focus.
43 virtual void OnWindowActivated() = 0;
46 // Returns an instance of TextService that works together with
47 // |text_store_delegate| as if it was an text area owned by |window_handle|.
48 scoped_ptr<TextService>
49 CreateTextService(TextServiceDelegate* delegate, HWND window_handle);
51 } // namespace metro_driver
53 #endif // WIN8_METRO_DRIVER_IME_TEXT_SERVICE_H_