Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(809)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine.cc

Issue 132453002: Moves CandidateWindow model to ui/base/ime (2nd) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/chromeos/input_method/input_method_engine.h" 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
6 6
7 #define XK_MISCELLANY 7 #define XK_MISCELLANY
8 #include <X11/keysymdef.h> 8 #include <X11/keysymdef.h>
9 #include <X11/X.h> 9 #include <X11/X.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
11 #include <X11/Xutil.h> 11 #include <X11/Xutil.h>
12 #undef FocusIn 12 #undef FocusIn
13 #undef FocusOut 13 #undef FocusOut
14 #undef RootWindow 14 #undef RootWindow
15 #include <map> 15 #include <map>
16 16
17 #include "ash/shell.h" 17 #include "ash/shell.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "chromeos/ime/candidate_window.h"
24 #include "chromeos/ime/component_extension_ime_manager.h" 23 #include "chromeos/ime/component_extension_ime_manager.h"
25 #include "chromeos/ime/extension_ime_util.h" 24 #include "chromeos/ime/extension_ime_util.h"
26 #include "chromeos/ime/ibus_keymap.h" 25 #include "chromeos/ime/ibus_keymap.h"
27 #include "chromeos/ime/ibus_text.h" 26 #include "chromeos/ime/ibus_text.h"
28 #include "chromeos/ime/input_method_manager.h" 27 #include "chromeos/ime/input_method_manager.h"
29 #include "ui/aura/root_window.h" 28 #include "ui/aura/root_window.h"
30 #include "ui/aura/window.h" 29 #include "ui/aura/window.h"
30 #include "ui/base/ime/candidate_window.h"
31 #include "ui/events/event.h" 31 #include "ui/events/event.h"
32 #include "ui/events/keycodes/dom4/keycode_converter.h" 32 #include "ui/events/keycodes/dom4/keycode_converter.h"
33 #include "ui/events/keycodes/keyboard_code_conversion_x.h" 33 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
34 #include "ui/keyboard/keyboard_controller.h" 34 #include "ui/keyboard/keyboard_controller.h"
35 35
36 namespace chromeos { 36 namespace chromeos {
37 const char* kErrorNotActive = "IME is not active"; 37 const char* kErrorNotActive = "IME is not active";
38 const char* kErrorWrongContext = "Context is not active"; 38 const char* kErrorWrongContext = "Context is not active";
39 const char* kCandidateNotFound = "Candidate not found"; 39 const char* kCandidateNotFound = "Candidate not found";
40 const char* kEngineBusPrefix = "org.freedesktop.IBus."; 40 const char* kEngineBusPrefix = "org.freedesktop.IBus.";
(...skipping 13 matching lines...) Expand all
54 } // namespace 54 } // namespace
55 55
56 InputMethodEngine::InputMethodEngine() 56 InputMethodEngine::InputMethodEngine()
57 : focused_(false), 57 : focused_(false),
58 active_(false), 58 active_(false),
59 context_id_(0), 59 context_id_(0),
60 next_context_id_(1), 60 next_context_id_(1),
61 observer_(NULL), 61 observer_(NULL),
62 preedit_text_(new IBusText()), 62 preedit_text_(new IBusText()),
63 preedit_cursor_(0), 63 preedit_cursor_(0),
64 candidate_window_(new input_method::CandidateWindow()), 64 candidate_window_(new ui::CandidateWindow()),
65 window_visible_(false) {} 65 window_visible_(false) {}
66 66
67 InputMethodEngine::~InputMethodEngine() { 67 InputMethodEngine::~InputMethodEngine() {
68 input_method::InputMethodManager::Get()->RemoveInputMethodExtension(imm_id_); 68 input_method::InputMethodManager::Get()->RemoveInputMethodExtension(imm_id_);
69 } 69 }
70 70
71 void InputMethodEngine::Initialize( 71 void InputMethodEngine::Initialize(
72 InputMethodEngineInterface::Observer* observer, 72 InputMethodEngineInterface::Observer* observer,
73 const char* engine_name, 73 const char* engine_name,
74 const char* extension_id, 74 const char* extension_id,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 const InputMethodEngine::CandidateWindowProperty& 248 const InputMethodEngine::CandidateWindowProperty&
249 InputMethodEngine::GetCandidateWindowProperty() const { 249 InputMethodEngine::GetCandidateWindowProperty() const {
250 return candidate_window_property_; 250 return candidate_window_property_;
251 } 251 }
252 252
253 void InputMethodEngine::SetCandidateWindowProperty( 253 void InputMethodEngine::SetCandidateWindowProperty(
254 const CandidateWindowProperty& property) { 254 const CandidateWindowProperty& property) {
255 // Type conversion from InputMethodEngineInterface::CandidateWindowProperty to 255 // Type conversion from InputMethodEngineInterface::CandidateWindowProperty to
256 // CandidateWindow::CandidateWindowProperty defined in chromeos/ime/. 256 // CandidateWindow::CandidateWindowProperty defined in chromeos/ime/.
257 input_method::CandidateWindow::CandidateWindowProperty dest_property; 257 ui::CandidateWindow::CandidateWindowProperty dest_property;
258 dest_property.page_size = property.page_size; 258 dest_property.page_size = property.page_size;
259 dest_property.is_cursor_visible = property.is_cursor_visible; 259 dest_property.is_cursor_visible = property.is_cursor_visible;
260 dest_property.is_vertical = property.is_vertical; 260 dest_property.is_vertical = property.is_vertical;
261 dest_property.show_window_at_composition = 261 dest_property.show_window_at_composition =
262 property.show_window_at_composition; 262 property.show_window_at_composition;
263 dest_property.cursor_position = 263 dest_property.cursor_position =
264 candidate_window_->GetProperty().cursor_position; 264 candidate_window_->GetProperty().cursor_position;
265 dest_property.auxiliary_text = property.auxiliary_text; 265 dest_property.auxiliary_text = property.auxiliary_text;
266 dest_property.is_auxiliary_text_visible = property.is_auxiliary_text_visible; 266 dest_property.is_auxiliary_text_visible = property.is_auxiliary_text_visible;
267 267
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 *error = kErrorWrongContext; 303 *error = kErrorWrongContext;
304 return false; 304 return false;
305 } 305 }
306 306
307 // TODO: Nested candidates 307 // TODO: Nested candidates
308 candidate_ids_.clear(); 308 candidate_ids_.clear();
309 candidate_indexes_.clear(); 309 candidate_indexes_.clear();
310 candidate_window_->mutable_candidates()->clear(); 310 candidate_window_->mutable_candidates()->clear();
311 for (std::vector<Candidate>::const_iterator ix = candidates.begin(); 311 for (std::vector<Candidate>::const_iterator ix = candidates.begin();
312 ix != candidates.end(); ++ix) { 312 ix != candidates.end(); ++ix) {
313 input_method::CandidateWindow::Entry entry; 313 ui::CandidateWindow::Entry entry;
314 entry.value = ix->value; 314 entry.value = ix->value;
315 entry.label = ix->label; 315 entry.label = ix->label;
316 entry.annotation = ix->annotation; 316 entry.annotation = ix->annotation;
317 entry.description_title = ix->usage.title; 317 entry.description_title = ix->usage.title;
318 entry.description_body = ix->usage.body; 318 entry.description_body = ix->usage.body;
319 319
320 // Store a mapping from the user defined ID to the candidate index. 320 // Store a mapping from the user defined ID to the candidate index.
321 candidate_indexes_[ix->id] = candidate_ids_.size(); 321 candidate_indexes_[ix->id] = candidate_ids_.size();
322 candidate_ids_.push_back(ix->id); 322 candidate_ids_.push_back(ix->id);
323 323
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // TODO(nona): Implement it. 614 // TODO(nona): Implement it.
615 break; 615 break;
616 } 616 }
617 } 617 }
618 } 618 }
619 619
620 // TODO(nona): Support item.children. 620 // TODO(nona): Support item.children.
621 } 621 }
622 622
623 } // namespace chromeos 623 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698