| 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/ui/input_method/input_method_engine_base.h" | 5 #include "chrome/browser/ui/input_method/input_method_engine_base.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #undef FocusIn | 9 #undef FocusIn |
| 8 #undef FocusOut | 10 #undef FocusOut |
| 9 #undef RootWindow | 11 #undef RootWindow |
| 10 #include <algorithm> | 12 #include <algorithm> |
| 11 #include <map> | 13 #include <map> |
| 12 | 14 |
| 13 #include "base/logging.h" | 15 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_tree_host.h" | 23 #include "ui/aura/window_tree_host.h" |
| 23 #include "ui/base/ime/composition_text.h" | 24 #include "ui/base/ime/composition_text.h" |
| 24 #include "ui/base/ime/ime_bridge.h" | 25 #include "ui/base/ime/ime_bridge.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 composition_cursor_(0), | 162 composition_cursor_(0), |
| 162 sent_key_event_(nullptr), | 163 sent_key_event_(nullptr), |
| 163 profile_(nullptr), | 164 profile_(nullptr), |
| 164 next_request_id_(1), | 165 next_request_id_(1), |
| 165 text_(""), | 166 text_(""), |
| 166 handling_key_event_(false) {} | 167 handling_key_event_(false) {} |
| 167 | 168 |
| 168 InputMethodEngineBase::~InputMethodEngineBase() {} | 169 InputMethodEngineBase::~InputMethodEngineBase() {} |
| 169 | 170 |
| 170 void InputMethodEngineBase::Initialize( | 171 void InputMethodEngineBase::Initialize( |
| 171 scoped_ptr<InputMethodEngineBase::Observer> observer, | 172 std::unique_ptr<InputMethodEngineBase::Observer> observer, |
| 172 const char* extension_id, | 173 const char* extension_id, |
| 173 Profile* profile) { | 174 Profile* profile) { |
| 174 DCHECK(observer) << "Observer must not be null."; | 175 DCHECK(observer) << "Observer must not be null."; |
| 175 | 176 |
| 176 // TODO(komatsu): It is probably better to set observer out of Initialize. | 177 // TODO(komatsu): It is probably better to set observer out of Initialize. |
| 177 observer_ = std::move(observer); | 178 observer_ = std::move(observer); |
| 178 extension_id_ = extension_id; | 179 extension_id_ = extension_id; |
| 179 profile_ = profile; | 180 profile_ = profile; |
| 180 } | 181 } |
| 181 | 182 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 ui::EventTimeForNow()); | 451 ui::EventTimeForNow()); |
| 451 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_, | 452 base::AutoReset<const ui::KeyEvent*> reset_sent_key(&sent_key_event_, |
| 452 &ui_event); | 453 &ui_event); |
| 453 if (!SendKeyEvent(&ui_event, event.code)) | 454 if (!SendKeyEvent(&ui_event, event.code)) |
| 454 return false; | 455 return false; |
| 455 } | 456 } |
| 456 return true; | 457 return true; |
| 457 } | 458 } |
| 458 | 459 |
| 459 } // namespace input_method | 460 } // namespace input_method |
| OLD | NEW |