OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/input_method/textinput_test_helper.h" | 9 #include "chrome/browser/chromeos/input_method/textinput_test_helper.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 ui::TextInputType TextInputTestHelper::GetTextInputType() const { | 66 ui::TextInputType TextInputTestHelper::GetTextInputType() const { |
67 return latest_text_input_type_; | 67 return latest_text_input_type_; |
68 } | 68 } |
69 | 69 |
70 ui::TextInputClient* TextInputTestHelper::GetTextInputClient() const { | 70 ui::TextInputClient* TextInputTestHelper::GetTextInputClient() const { |
71 return GetInputMethod()->GetTextInputClient(); | 71 return GetInputMethod()->GetTextInputClient(); |
72 } | 72 } |
73 | 73 |
74 void TextInputTestHelper::OnTextInputTypeChanged( | 74 void TextInputTestHelper::OnTextInputTypeChanged( |
75 const ui::TextInputClient* client) { | 75 const ui::TextInputClient* client) { |
76 latest_text_input_type_ = | 76 latest_text_input_type_ = client->GetTextInputType(); |
77 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; | |
78 if (waiting_type_ == WAIT_ON_TEXT_INPUT_TYPE_CHANGED) | 77 if (waiting_type_ == WAIT_ON_TEXT_INPUT_TYPE_CHANGED) |
79 base::MessageLoop::current()->Quit(); | 78 base::MessageLoop::current()->Quit(); |
80 } | 79 } |
81 | 80 |
82 void TextInputTestHelper::OnInputMethodDestroyed( | 81 void TextInputTestHelper::OnInputMethodDestroyed( |
83 const ui::InputMethod* input_method) { | 82 const ui::InputMethod* input_method) { |
84 } | 83 } |
85 | 84 |
86 void TextInputTestHelper::OnFocus() { | 85 void TextInputTestHelper::OnFocus() { |
87 focus_state_ = true; | 86 focus_state_ = true; |
88 if (waiting_type_ == WAIT_ON_FOCUS) | 87 if (waiting_type_ == WAIT_ON_FOCUS) |
89 base::MessageLoop::current()->Quit(); | 88 base::MessageLoop::current()->Quit(); |
90 } | 89 } |
91 | 90 |
92 void TextInputTestHelper::OnBlur() { | 91 void TextInputTestHelper::OnBlur() { |
93 focus_state_ = false; | 92 focus_state_ = false; |
94 if (waiting_type_ == WAIT_ON_BLUR) | 93 if (waiting_type_ == WAIT_ON_BLUR) |
95 base::MessageLoop::current()->Quit(); | 94 base::MessageLoop::current()->Quit(); |
96 } | 95 } |
97 | 96 |
98 void TextInputTestHelper::OnUntranslatedIMEMessage( | 97 void TextInputTestHelper::OnUntranslatedIMEMessage( |
99 const base::NativeEvent& event) { | 98 const base::NativeEvent& event) { |
100 } | 99 } |
101 | 100 |
102 void TextInputTestHelper::OnCaretBoundsChanged( | 101 void TextInputTestHelper::OnCaretBoundsChanged( |
103 const ui::TextInputClient* client) { | 102 const ui::TextInputClient* client) { |
104 ui::Range text_range; | 103 ui::Range text_range; |
105 if (!GetTextInputClient() || GetTextInputClient() != client || | 104 if (!GetTextInputClient()->GetTextRange(&text_range) || |
106 !GetTextInputClient()->GetTextRange(&text_range) || | |
107 !GetTextInputClient()->GetTextFromRange(text_range, &surrounding_text_) || | 105 !GetTextInputClient()->GetTextFromRange(text_range, &surrounding_text_) || |
108 !GetTextInputClient()->GetSelectionRange(&selection_range_)) | 106 !GetTextInputClient()->GetSelectionRange(&selection_range_)) |
109 return; | 107 return; |
110 if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED) | 108 if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED) |
111 base::MessageLoop::current()->Quit(); | 109 base::MessageLoop::current()->Quit(); |
112 } | 110 } |
113 | 111 |
114 void TextInputTestHelper::OnInputLocaleChanged() { | 112 void TextInputTestHelper::OnInputLocaleChanged() { |
115 } | 113 } |
116 | 114 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 mouse_event.y = rect.CenterPoint().y(); | 201 mouse_event.y = rect.CenterPoint().y(); |
204 mouse_event.clickCount = 1; | 202 mouse_event.clickCount = 1; |
205 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 203 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
206 | 204 |
207 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 205 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
208 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 206 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
209 return true; | 207 return true; |
210 } | 208 } |
211 | 209 |
212 } // namespace chromeos | 210 } // namespace chromeos |
OLD | NEW |