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

Side by Side Diff: content/public/test/text_input_test_utils.h

Issue 2696883002: Fix a recent regression in IME inside OOPIFs (Merge to M-57) (Closed)
Patch Set: Created 3 years, 10 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 CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ 5 #ifndef CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_
6 #define CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ 6 #define CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "ui/base/ime/text_input_mode.h" 13 #include "ui/base/ime/text_input_mode.h"
14 #include "ui/base/ime/text_input_type.h" 14 #include "ui/base/ime/text_input_type.h"
15 15
16 #ifdef OS_MACOSX 16 #ifdef OS_MACOSX
17 #include "content/public/browser/browser_message_filter.h" 17 #include "content/public/browser/browser_message_filter.h"
18 #endif 18 #endif
19 19
20 namespace ipc { 20 namespace ipc {
21 class Message; 21 class Message;
22 } 22 }
23 23
24 namespace gfx { 24 namespace gfx {
25 class Range; 25 class Range;
26 } 26 }
27 27
28 namespace ui {
29 struct CompositionUnderline;
30 }
31
28 namespace content { 32 namespace content {
29 33
30 class MessageLoopRunner; 34 class MessageLoopRunner;
31 class RenderFrameHost; 35 class RenderFrameHost;
32 class RenderProcessHost; 36 class RenderProcessHost;
33 class RenderWidgetHost; 37 class RenderWidgetHost;
34 class RenderWidgetHostView; 38 class RenderWidgetHostView;
35 class RenderWidgetHostViewBase; 39 class RenderWidgetHostViewBase;
36 class WebContents; 40 class WebContents;
37 struct TextInputState; 41 struct TextInputState;
(...skipping 20 matching lines...) Expand all
58 62
59 // This method will send a request for an immediate update on composition range 63 // This method will send a request for an immediate update on composition range
60 // from TextInputManager's active widget corresponding to the |web_contents|. 64 // from TextInputManager's active widget corresponding to the |web_contents|.
61 // This function will return false if the request is not successfully sent; 65 // This function will return false if the request is not successfully sent;
62 // either due to missing TextInputManager or lack of an active widget. 66 // either due to missing TextInputManager or lack of an active widget.
63 bool RequestCompositionInfoFromActiveWidget(WebContents* web_contents); 67 bool RequestCompositionInfoFromActiveWidget(WebContents* web_contents);
64 68
65 // Returns true if |frame| has a focused editable element. 69 // Returns true if |frame| has a focused editable element.
66 bool DoesFrameHaveFocusedEditableElement(RenderFrameHost* frame); 70 bool DoesFrameHaveFocusedEditableElement(RenderFrameHost* frame);
67 71
72 // Sends a request to the RenderWidget corresponding to |rwh| to commit the
73 // given |text|.
74 void SendImeCommitTextToWidget(
75 RenderWidgetHost* rwh,
76 const base::string16& text,
77 const std::vector<ui::CompositionUnderline>& underlines,
78 const gfx::Range& replacement_range,
79 int relative_cursor_pos);
80
68 // This class provides the necessary API for accessing the state of and also 81 // This class provides the necessary API for accessing the state of and also
69 // observing the TextInputManager for WebContents. 82 // observing the TextInputManager for WebContents.
70 class TextInputManagerTester { 83 class TextInputManagerTester {
71 public: 84 public:
72 TextInputManagerTester(WebContents* web_contents); 85 TextInputManagerTester(WebContents* web_contents);
73 virtual ~TextInputManagerTester(); 86 virtual ~TextInputManagerTester();
74 87
75 // Sets a callback which is invoked when a RWHV calls UpdateTextInputState 88 // Sets a callback which is invoked when a RWHV calls UpdateTextInputState
76 // on the TextInputManager which is being observed. 89 // on the TextInputManager which is being observed.
77 void SetUpdateTextInputStateCalledCallback(const base::Closure& callback); 90 void SetUpdateTextInputStateCalledCallback(const base::Closure& callback);
(...skipping 21 matching lines...) Expand all
99 // Returns true if there is a focused <input> and populates |length| with the 112 // Returns true if there is a focused <input> and populates |length| with the
100 // length of the selected text range in the focused view. 113 // length of the selected text range in the focused view.
101 bool GetCurrentTextSelectionLength(size_t* length); 114 bool GetCurrentTextSelectionLength(size_t* length);
102 115
103 // Returns the RenderWidgetHostView with a focused <input> element or nullptr 116 // Returns the RenderWidgetHostView with a focused <input> element or nullptr
104 // if none exists. 117 // if none exists.
105 const RenderWidgetHostView* GetActiveView(); 118 const RenderWidgetHostView* GetActiveView();
106 119
107 // Returns the RenderWidgetHostView which has most recently updated any of its 120 // Returns the RenderWidgetHostView which has most recently updated any of its
108 // state (e.g., TextInputState or otherwise). 121 // state (e.g., TextInputState or otherwise).
109 const RenderWidgetHostView* GetUpdatedView(); 122 RenderWidgetHostView* GetUpdatedView();
110 123
111 // Returns true if a call to TextInputManager::UpdateTextInputState has led 124 // Returns true if a call to TextInputManager::UpdateTextInputState has led
112 // to a change in TextInputState (since the time the observer has been 125 // to a change in TextInputState (since the time the observer has been
113 // created). 126 // created).
114 bool IsTextInputStateChanged(); 127 bool IsTextInputStateChanged();
115 128
116 private: 129 private:
117 // The actual internal observer of the TextInputManager. 130 // The actual internal observer of the TextInputManager.
118 class InternalObserver; 131 class InternalObserver;
119 132
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 const gfx::Range& range); 240 const gfx::Range& range);
228 241
229 // Returns the total count of NSWindows instances which belong to the currently 242 // Returns the total count of NSWindows instances which belong to the currently
230 // running NSApplication. 243 // running NSApplication.
231 size_t GetOpenNSWindowsCount(); 244 size_t GetOpenNSWindowsCount();
232 #endif 245 #endif
233 246
234 } // namespace content 247 } // namespace content
235 248
236 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ 249 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc ('k') | content/public/test/text_input_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698