| 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_ = client->GetTextInputType(); | 76 latest_text_input_type_ = |
| 77 client ? client->GetTextInputType() : ui::TEXT_INPUT_TYPE_NONE; |
| 77 if (waiting_type_ == WAIT_ON_TEXT_INPUT_TYPE_CHANGED) | 78 if (waiting_type_ == WAIT_ON_TEXT_INPUT_TYPE_CHANGED) |
| 78 base::MessageLoop::current()->Quit(); | 79 base::MessageLoop::current()->Quit(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 void TextInputTestHelper::OnInputMethodDestroyed( | 82 void TextInputTestHelper::OnInputMethodDestroyed( |
| 82 const ui::InputMethod* input_method) { | 83 const ui::InputMethod* input_method) { |
| 83 } | 84 } |
| 84 | 85 |
| 85 void TextInputTestHelper::OnFocus() { | 86 void TextInputTestHelper::OnFocus() { |
| 86 focus_state_ = true; | 87 focus_state_ = true; |
| 87 if (waiting_type_ == WAIT_ON_FOCUS) | 88 if (waiting_type_ == WAIT_ON_FOCUS) |
| 88 base::MessageLoop::current()->Quit(); | 89 base::MessageLoop::current()->Quit(); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void TextInputTestHelper::OnBlur() { | 92 void TextInputTestHelper::OnBlur() { |
| 92 focus_state_ = false; | 93 focus_state_ = false; |
| 93 if (waiting_type_ == WAIT_ON_BLUR) | 94 if (waiting_type_ == WAIT_ON_BLUR) |
| 94 base::MessageLoop::current()->Quit(); | 95 base::MessageLoop::current()->Quit(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 void TextInputTestHelper::OnUntranslatedIMEMessage( | 98 void TextInputTestHelper::OnUntranslatedIMEMessage( |
| 98 const base::NativeEvent& event) { | 99 const base::NativeEvent& event) { |
| 99 } | 100 } |
| 100 | 101 |
| 101 void TextInputTestHelper::OnCaretBoundsChanged( | 102 void TextInputTestHelper::OnCaretBoundsChanged( |
| 102 const ui::TextInputClient* client) { | 103 const ui::TextInputClient* client) { |
| 103 ui::Range text_range; | 104 ui::Range text_range; |
| 104 if (!GetTextInputClient()->GetTextRange(&text_range) || | 105 if (!GetTextInputClient() || GetTextInputClient() != client || |
| 106 !GetTextInputClient()->GetTextRange(&text_range) || |
| 105 !GetTextInputClient()->GetTextFromRange(text_range, &surrounding_text_) || | 107 !GetTextInputClient()->GetTextFromRange(text_range, &surrounding_text_) || |
| 106 !GetTextInputClient()->GetSelectionRange(&selection_range_)) | 108 !GetTextInputClient()->GetSelectionRange(&selection_range_)) |
| 107 return; | 109 return; |
| 108 if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED) | 110 if (waiting_type_ == WAIT_ON_CARET_BOUNDS_CHANGED) |
| 109 base::MessageLoop::current()->Quit(); | 111 base::MessageLoop::current()->Quit(); |
| 110 } | 112 } |
| 111 | 113 |
| 112 void TextInputTestHelper::OnInputLocaleChanged() { | 114 void TextInputTestHelper::OnInputLocaleChanged() { |
| 113 } | 115 } |
| 114 | 116 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 mouse_event.y = rect.CenterPoint().y(); | 203 mouse_event.y = rect.CenterPoint().y(); |
| 202 mouse_event.clickCount = 1; | 204 mouse_event.clickCount = 1; |
| 203 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 205 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
| 204 | 206 |
| 205 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 207 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
| 206 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); | 208 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); |
| 207 return true; | 209 return true; |
| 208 } | 210 } |
| 209 | 211 |
| 210 } // namespace chromeos | 212 } // namespace chromeos |
| OLD | NEW |