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

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

Issue 126363002: Moves CandidateWindow model to ui/base/ime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix visibility issue 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(ibus_id_); 68 input_method::InputMethodManager::Get()->RemoveInputMethodExtension(ibus_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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 const InputMethodEngine::CandidateWindowProperty& 234 const InputMethodEngine::CandidateWindowProperty&
235 InputMethodEngine::GetCandidateWindowProperty() const { 235 InputMethodEngine::GetCandidateWindowProperty() const {
236 return candidate_window_property_; 236 return candidate_window_property_;
237 } 237 }
238 238
239 void InputMethodEngine::SetCandidateWindowProperty( 239 void InputMethodEngine::SetCandidateWindowProperty(
240 const CandidateWindowProperty& property) { 240 const CandidateWindowProperty& property) {
241 // Type conversion from InputMethodEngineInterface::CandidateWindowProperty to 241 // Type conversion from InputMethodEngineInterface::CandidateWindowProperty to
242 // CandidateWindow::CandidateWindowProperty defined in chromeos/ime/. 242 // CandidateWindow::CandidateWindowProperty defined in chromeos/ime/.
243 input_method::CandidateWindow::CandidateWindowProperty dest_property; 243 ui::CandidateWindow::CandidateWindowProperty dest_property;
244 dest_property.page_size = property.page_size; 244 dest_property.page_size = property.page_size;
245 dest_property.is_cursor_visible = property.is_cursor_visible; 245 dest_property.is_cursor_visible = property.is_cursor_visible;
246 dest_property.is_vertical = property.is_vertical; 246 dest_property.is_vertical = property.is_vertical;
247 dest_property.show_window_at_composition = 247 dest_property.show_window_at_composition =
248 property.show_window_at_composition; 248 property.show_window_at_composition;
249 dest_property.cursor_position = 249 dest_property.cursor_position =
250 candidate_window_->GetProperty().cursor_position; 250 candidate_window_->GetProperty().cursor_position;
251 dest_property.auxiliary_text = property.auxiliary_text; 251 dest_property.auxiliary_text = property.auxiliary_text;
252 dest_property.is_auxiliary_text_visible = property.is_auxiliary_text_visible; 252 dest_property.is_auxiliary_text_visible = property.is_auxiliary_text_visible;
253 253
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 *error = kErrorWrongContext; 289 *error = kErrorWrongContext;
290 return false; 290 return false;
291 } 291 }
292 292
293 // TODO: Nested candidates 293 // TODO: Nested candidates
294 candidate_ids_.clear(); 294 candidate_ids_.clear();
295 candidate_indexes_.clear(); 295 candidate_indexes_.clear();
296 candidate_window_->mutable_candidates()->clear(); 296 candidate_window_->mutable_candidates()->clear();
297 for (std::vector<Candidate>::const_iterator ix = candidates.begin(); 297 for (std::vector<Candidate>::const_iterator ix = candidates.begin();
298 ix != candidates.end(); ++ix) { 298 ix != candidates.end(); ++ix) {
299 input_method::CandidateWindow::Entry entry; 299 ui::CandidateWindow::Entry entry;
300 entry.value = ix->value; 300 entry.value = ix->value;
301 entry.label = ix->label; 301 entry.label = ix->label;
302 entry.annotation = ix->annotation; 302 entry.annotation = ix->annotation;
303 entry.description_title = ix->usage.title; 303 entry.description_title = ix->usage.title;
304 entry.description_body = ix->usage.body; 304 entry.description_body = ix->usage.body;
305 305
306 // Store a mapping from the user defined ID to the candidate index. 306 // Store a mapping from the user defined ID to the candidate index.
307 candidate_indexes_[ix->id] = candidate_ids_.size(); 307 candidate_indexes_[ix->id] = candidate_ids_.size();
308 candidate_ids_.push_back(ix->id); 308 candidate_ids_.push_back(ix->id);
309 309
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 // TODO(nona): Implement it. 600 // TODO(nona): Implement it.
601 break; 601 break;
602 } 602 }
603 } 603 }
604 } 604 }
605 605
606 // TODO(nona): Support item.children. 606 // TODO(nona): Support item.children.
607 } 607 }
608 608
609 } // namespace chromeos 609 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698