summaryrefslogtreecommitdiffstats
path: root/win8/metro_driver/ime/text_service_delegate.h
blob: ea9cde72ec5ce4d1a2a688c4e96ed1beefc4611b (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
// 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_DELEGATE_H_
#define WIN8_METRO_DRIVER_IME_TEXT_SERVICE_DELEGATE_H_

#include <vector>

#include "base/basictypes.h"
#include "base/strings/string16.h"

namespace metro_viewer {
struct UnderlineInfo;
}

namespace metro_driver {

// A delegate which works together with virtual text service.
// Objects that implement this delegate will receive notifications from a
// virtual text service whenever an IME updates the composition or commits text.
class TextServiceDelegate {
 public:
  virtual ~TextServiceDelegate() {}

  // Called when on-going composition is updated. An empty |text| represents
  // that the composition is canceled.
  virtual void OnCompositionChanged(
      const string16& text,
      int32 selection_start,
      int32 selection_end,
      const std::vector<metro_viewer::UnderlineInfo>& underlines) = 0;

  // Called when |text| is committed.
  virtual void OnTextCommitted(const string16& text) = 0;
};

}  // namespace metro_driver

#endif  // WIN8_METRO_DRIVER_IME_TEXT_SERVICE_DELEGATE_H_