Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / ppapi / cpp / dev / text_input_dev.h
blobfca87280467f38d6e674cc710cb111b4553cccb9
1 // Copyright (c) 2012 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 PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_
6 #define PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_
8 #include <string>
10 #include "ppapi/c/dev/ppb_text_input_dev.h"
11 #include "ppapi/cpp/instance_handle.h"
13 namespace pp {
15 class Rect;
16 class Instance;
18 // This class allows you to associate the PPP_TextInput_Dev and
19 // PPB_TextInput_Dev C-based interfaces with an object. It associates itself
20 // with the given instance, and registers as the global handler for handling the
21 // PPP_TextInput_Dev interface that the browser calls.
23 // You would typically use this either via inheritance on your instance:
24 // class MyInstance : public pp::Instance, public pp::TextInput_Dev {
25 // MyInstance() : pp::TextInput_Dev(this) {
26 // }
27 // ...
28 // };
30 // or by composition:
31 // class MyTextInput : public pp::TextInput_Dev {
32 // ...
33 // };
35 // class MyInstance : public pp::Instance {
36 // MyInstance() : text_input_(this) {
37 // }
39 // MyTextInput text_input_;
40 // };
41 class TextInput_Dev {
42 public:
43 explicit TextInput_Dev(Instance* instance);
44 virtual ~TextInput_Dev();
46 virtual void RequestSurroundingText(uint32_t desired_number_of_characters);
48 void SetTextInputType(PP_TextInput_Type_Dev type);
49 void UpdateCaretPosition(const Rect& caret, const Rect& bounding_box);
50 void CancelCompositionText();
51 void SelectionChanged();
52 void UpdateSurroundingText(const std::string& text,
53 uint32_t caret, uint32_t anchor);
55 private:
56 InstanceHandle instance_;
59 } // namespace pp
61 #endif // PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_