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