Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: chrome/browser/ui/views/ime_driver/remote_text_input_client.h

Issue 2957173004: Make DispatchKeyEventPostIME() asynchronous.
Patch Set: cleanup. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_UI_VIEWS_IME_DRIVER_REMOTE_TEXT_INPUT_CLIENT_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_IME_DRIVER_REMOTE_TEXT_INPUT_CLIENT_H_
6 #define CHROME_BROWSER_UI_VIEWS_IME_DRIVER_REMOTE_TEXT_INPUT_CLIENT_H_ 6 #define CHROME_BROWSER_UI_VIEWS_IME_DRIVER_REMOTE_TEXT_INPUT_CLIENT_H_
7 7
8 #include "services/ui/public/interfaces/ime/ime.mojom.h" 8 #include "services/ui/public/interfaces/ime/ime.mojom.h"
9 #include "ui/base/ime/input_method_delegate.h"
9 #include "ui/base/ime/text_input_client.h" 10 #include "ui/base/ime/text_input_client.h"
10 11
11 // This implementation of ui::TextInputClient sends all updates via mojo IPC to 12 // This implementation of ui::TextInputClient sends all updates via mojo IPC to
12 // a remote client. This is intended to be passed to the overrides of 13 // a remote client. This is intended to be passed to the overrides of
13 // ui::InputMethod::SetFocusedTextInputClient(). 14 // ui::InputMethod::SetFocusedTextInputClient().
14 class RemoteTextInputClient : public ui::TextInputClient { 15 class RemoteTextInputClient : public ui::TextInputClient,
16 public ui::internal::InputMethodDelegate {
15 public: 17 public:
16 RemoteTextInputClient(ui::mojom::TextInputClientPtr remote_client, 18 RemoteTextInputClient(ui::mojom::TextInputClientPtr remote_client,
17 ui::TextInputType text_input_type, 19 ui::TextInputType text_input_type,
18 ui::TextInputMode text_input_mode, 20 ui::TextInputMode text_input_mode,
19 base::i18n::TextDirection text_direction, 21 base::i18n::TextDirection text_direction,
20 int text_input_flags, 22 int text_input_flags,
21 gfx::Rect caret_bounds); 23 gfx::Rect caret_bounds);
22 ~RemoteTextInputClient() override; 24 ~RemoteTextInputClient() override;
23 25
24 void SetTextInputType(ui::TextInputType text_input_type); 26 void SetTextInputType(ui::TextInputType text_input_type);
(...skipping 23 matching lines...) Expand all
48 bool GetTextFromRange(const gfx::Range& range, 50 bool GetTextFromRange(const gfx::Range& range,
49 base::string16* text) const override; 51 base::string16* text) const override;
50 void OnInputMethodChanged() override; 52 void OnInputMethodChanged() override;
51 bool ChangeTextDirectionAndLayoutAlignment( 53 bool ChangeTextDirectionAndLayoutAlignment(
52 base::i18n::TextDirection direction) override; 54 base::i18n::TextDirection direction) override;
53 void ExtendSelectionAndDelete(size_t before, size_t after) override; 55 void ExtendSelectionAndDelete(size_t before, size_t after) override;
54 void EnsureCaretNotInRect(const gfx::Rect& rect) override; 56 void EnsureCaretNotInRect(const gfx::Rect& rect) override;
55 bool IsTextEditCommandEnabled(ui::TextEditCommand command) const override; 57 bool IsTextEditCommandEnabled(ui::TextEditCommand command) const override;
56 void SetTextEditCommandForNextKeyEvent(ui::TextEditCommand command) override; 58 void SetTextEditCommandForNextKeyEvent(ui::TextEditCommand command) override;
57 59
60 // ui::internal::InputMethodDelegate:
61 ui::EventDispatchDetails DispatchKeyEventPostIME(
62 ui::KeyEvent* event) override;
63 ui::EventDispatchDetails DispatchKeyEventPostIME(
64 ui::KeyEvent* key_event,
65 std::unique_ptr<base::Callback<void(bool)>> ack_callback) override;
66
67 void DispatchKeyEventPostIMECallback(bool stopped_propagation);
68
58 ui::mojom::TextInputClientPtr remote_client_; 69 ui::mojom::TextInputClientPtr remote_client_;
59 ui::TextInputType text_input_type_; 70 ui::TextInputType text_input_type_;
60 ui::TextInputMode text_input_mode_; 71 ui::TextInputMode text_input_mode_;
61 base::i18n::TextDirection text_direction_; 72 base::i18n::TextDirection text_direction_;
62 int text_input_flags_; 73 int text_input_flags_;
63 gfx::Rect caret_bounds_; 74 gfx::Rect caret_bounds_;
75 std::deque<std::unique_ptr<base::Callback<void(bool)>>> pending_callbacks_;
64 76
65 DISALLOW_COPY_AND_ASSIGN(RemoteTextInputClient); 77 DISALLOW_COPY_AND_ASSIGN(RemoteTextInputClient);
66 }; 78 };
67 79
68 #endif // CHROME_BROWSER_UI_VIEWS_IME_DRIVER_REMOTE_TEXT_INPUT_CLIENT_H_ 80 #endif // CHROME_BROWSER_UI_VIEWS_IME_DRIVER_REMOTE_TEXT_INPUT_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698