| OLD | NEW |
| 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 #include "chrome/browser/input_method/input_method_engine_base.h" | 5 #include "chrome/browser/input_method/input_method_engine_base.h" |
| 6 | 6 |
| 7 #undef FocusIn | 7 #undef FocusIn |
| 8 #undef FocusOut | 8 #undef FocusOut |
| 9 #undef RootWindow | 9 #undef RootWindow |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 ext_event->caps_lock = event.IsCapsLockOn(); | 161 ext_event->caps_lock = event.IsCapsLockOn(); |
| 162 #if defined(OS_CHROMEOS) | 162 #if defined(OS_CHROMEOS) |
| 163 ext_event->key = GetKeyFromEvent(event); | 163 ext_event->key = GetKeyFromEvent(event); |
| 164 #else | 164 #else |
| 165 ext_event->key = ui::KeycodeConverter::DomKeyToKeyString(event.GetDomKey()); | 165 ext_event->key = ui::KeycodeConverter::DomKeyToKeyString(event.GetDomKey()); |
| 166 #endif // defined(OS_CHROMEOS) | 166 #endif // defined(OS_CHROMEOS) |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace | 169 } // namespace |
| 170 | 170 |
| 171 InputMethodEngineBase::KeyboardEvent::KeyboardEvent() |
| 172 : alt_key(false), ctrl_key(false), shift_key(false), caps_lock(false) {} |
| 173 |
| 174 InputMethodEngineBase::KeyboardEvent::~KeyboardEvent() {} |
| 175 |
| 171 InputMethodEngineBase::InputMethodEngineBase() | 176 InputMethodEngineBase::InputMethodEngineBase() |
| 172 : current_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 177 : current_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 173 context_id_(0), | 178 context_id_(0), |
| 174 next_context_id_(1), | 179 next_context_id_(1), |
| 175 composition_text_(new ui::CompositionText()), | 180 composition_text_(new ui::CompositionText()), |
| 176 composition_cursor_(0), | 181 composition_cursor_(0), |
| 177 sent_key_event_(NULL), | 182 sent_key_event_(NULL), |
| 178 profile_(NULL) {} | 183 profile_(NULL) {} |
| 179 | 184 |
| 180 InputMethodEngineBase::~InputMethodEngineBase() {} | 185 InputMethodEngineBase::~InputMethodEngineBase() {} |
| 181 | 186 |
| 182 void InputMethodEngineBase::Initialize( | 187 void InputMethodEngineBase::Initialize( |
| 183 scoped_ptr<ui::IMEEngineObserver> observer, | 188 scoped_ptr<InputMethodEngineBase::Observer> observer, |
| 184 const char* extension_id, | 189 const char* extension_id, |
| 185 Profile* profile) { | 190 Profile* profile) { |
| 186 DCHECK(observer) << "Observer must not be null."; | 191 DCHECK(observer) << "Observer must not be null."; |
| 187 | 192 |
| 188 // TODO(komatsu): It is probably better to set observer out of Initialize. | 193 // TODO(komatsu): It is probably better to set observer out of Initialize. |
| 189 observer_ = std::move(observer); | 194 observer_ = std::move(observer); |
| 190 extension_id_ = extension_id; | 195 extension_id_ = extension_id; |
| 191 profile_ = profile; | 196 profile_ = profile; |
| 192 } | 197 } |
| 193 | 198 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 void InputMethodEngineBase::SetSurroundingText(const std::string& text, | 395 void InputMethodEngineBase::SetSurroundingText(const std::string& text, |
| 391 uint32_t cursor_pos, | 396 uint32_t cursor_pos, |
| 392 uint32_t anchor_pos, | 397 uint32_t anchor_pos, |
| 393 uint32_t offset_pos) { | 398 uint32_t offset_pos) { |
| 394 observer_->OnSurroundingTextChanged( | 399 observer_->OnSurroundingTextChanged( |
| 395 active_component_id_, text, static_cast<int>(cursor_pos), | 400 active_component_id_, text, static_cast<int>(cursor_pos), |
| 396 static_cast<int>(anchor_pos), static_cast<int>(offset_pos)); | 401 static_cast<int>(anchor_pos), static_cast<int>(offset_pos)); |
| 397 } | 402 } |
| 398 | 403 |
| 399 } // namespace input_method | 404 } // namespace input_method |
| OLD | NEW |