Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / win8 / metro_driver / ime / text_store_delegate.h
blob153d664f4ead307acb5276bf181f3ef1c9aeb015
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_STORE_DELEGATE_H_
6 #define WIN8_METRO_DRIVER_IME_TEXT_STORE_DELEGATE_H_
8 #include <vector>
10 #include <windows.h>
12 #include "base/basictypes.h"
13 #include "base/strings/string16.h"
15 namespace metro_viewer {
16 struct UnderlineInfo;
19 namespace metro_driver {
21 // A delegate which works together with virtual text stores.
22 // Objects that implement this delegate will receive notifications from a
23 // virtual text store whenever an IME updates the composition or commits text.
24 // Objects that implement this delegate are also responsible for calculating
25 // the character position of composition and caret position upon request.
26 class TextStoreDelegate {
27 public:
28 virtual ~TextStoreDelegate() {}
30 // Called when on-going composition is updated. An empty |text| represents
31 // that the composition is canceled.
32 virtual void OnCompositionChanged(
33 const base::string16& text,
34 int32 selection_start,
35 int32 selection_end,
36 const std::vector<metro_viewer::UnderlineInfo>& underlines) = 0;
38 // Called when |text| is committed.
39 virtual void OnTextCommitted(const base::string16& text) = 0;
41 // Called when an IME requests the caret position. Objects that implement
42 // this method must return the caret position in screen coordinates.
43 virtual RECT GetCaretBounds() = 0;
45 // Called when an IME requests the bounding box of an character whose
46 // index is |index| in the on-going composition. position. Objects that
47 // implement this method must return true and fill the character bounds into
48 // |rect| in screen coordinates.
49 // Should return false if |index| is invalid.
50 virtual bool GetCompositionCharacterBounds(uint32 index, RECT* rect) = 0;
53 } // namespace metro_driver
55 #endif // WIN8_METRO_DRIVER_IME_TEXT_STORE_DELEGATE_H_