| 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 |
| 176 InputMethodEngineBase::Observer::~Observer() {} |
| 177 |
| 171 InputMethodEngineBase::InputMethodEngineBase() | 178 InputMethodEngineBase::InputMethodEngineBase() |
| 172 : current_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 179 : current_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 173 context_id_(0), | 180 context_id_(0), |
| 174 next_context_id_(1), | 181 next_context_id_(1), |
| 175 composition_text_(new ui::CompositionText()), | 182 composition_text_(new ui::CompositionText()), |
| 176 composition_cursor_(0), | 183 composition_cursor_(0), |
| 177 sent_key_event_(NULL), | 184 sent_key_event_(NULL), |
| 178 profile_(NULL) {} | 185 profile_(NULL) {} |
| 179 | 186 |
| 180 InputMethodEngineBase::~InputMethodEngineBase() {} | 187 InputMethodEngineBase::~InputMethodEngineBase() {} |
| 181 | 188 |
| 182 void InputMethodEngineBase::Initialize( | 189 void InputMethodEngineBase::Initialize( |
| 183 scoped_ptr<ui::IMEEngineObserver> observer, | 190 scoped_ptr<InputMethodEngineBase::Observer> observer, |
| 184 const char* extension_id, | 191 const char* extension_id, |
| 185 Profile* profile) { | 192 Profile* profile) { |
| 186 DCHECK(observer) << "Observer must not be null."; | 193 DCHECK(observer) << "Observer must not be null."; |
| 187 | 194 |
| 188 // TODO(komatsu): It is probably better to set observer out of Initialize. | 195 // TODO(komatsu): It is probably better to set observer out of Initialize. |
| 189 observer_ = std::move(observer); | 196 observer_ = std::move(observer); |
| 190 extension_id_ = extension_id; | 197 extension_id_ = extension_id; |
| 191 profile_ = profile; | 198 profile_ = profile; |
| 192 } | 199 } |
| 193 | 200 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 void InputMethodEngineBase::SetSurroundingText(const std::string& text, | 397 void InputMethodEngineBase::SetSurroundingText(const std::string& text, |
| 391 uint32_t cursor_pos, | 398 uint32_t cursor_pos, |
| 392 uint32_t anchor_pos, | 399 uint32_t anchor_pos, |
| 393 uint32_t offset_pos) { | 400 uint32_t offset_pos) { |
| 394 observer_->OnSurroundingTextChanged( | 401 observer_->OnSurroundingTextChanged( |
| 395 active_component_id_, text, static_cast<int>(cursor_pos), | 402 active_component_id_, text, static_cast<int>(cursor_pos), |
| 396 static_cast<int>(anchor_pos), static_cast<int>(offset_pos)); | 403 static_cast<int>(anchor_pos), static_cast<int>(offset_pos)); |
| 397 } | 404 } |
| 398 | 405 |
| 399 } // namespace input_method | 406 } // namespace input_method |
| OLD | NEW |