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