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

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

Issue 165453002: Revert 251164 "Split out InputMethodMenuManager from InputMethod..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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/ime/input_method_menu_item.h"
18 #include "ash/ime/input_method_menu_manager.h"
19 #include "ash/shell.h" 17 #include "ash/shell.h"
20 #include "base/logging.h" 18 #include "base/logging.h"
21 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
22 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
24 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
25 #include "chromeos/ime/component_extension_ime_manager.h" 23 #include "chromeos/ime/component_extension_ime_manager.h"
26 #include "chromeos/ime/composition_text.h" 24 #include "chromeos/ime/composition_text.h"
27 #include "chromeos/ime/extension_ime_util.h" 25 #include "chromeos/ime/extension_ime_util.h"
28 #include "chromeos/ime/ibus_keymap.h" 26 #include "chromeos/ime/ibus_keymap.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 364
367 bool InputMethodEngine::SetMenuItems(const std::vector<MenuItem>& items) { 365 bool InputMethodEngine::SetMenuItems(const std::vector<MenuItem>& items) {
368 return UpdateMenuItems(items); 366 return UpdateMenuItems(items);
369 } 367 }
370 368
371 bool InputMethodEngine::UpdateMenuItems( 369 bool InputMethodEngine::UpdateMenuItems(
372 const std::vector<MenuItem>& items) { 370 const std::vector<MenuItem>& items) {
373 if (!active_) 371 if (!active_)
374 return false; 372 return false;
375 373
376 ash::ime::InputMethodMenuItemList menu_item_list; 374 input_method::InputMethodPropertyList property_list;
377 for (std::vector<MenuItem>::const_iterator item = items.begin(); 375 for (std::vector<MenuItem>::const_iterator item = items.begin();
378 item != items.end(); ++item) { 376 item != items.end(); ++item) {
379 ash::ime::InputMethodMenuItem property; 377 input_method::InputMethodProperty property;
380 MenuItemToProperty(*item, &property); 378 MenuItemToProperty(*item, &property);
381 menu_item_list.push_back(property); 379 property_list.push_back(property);
382 } 380 }
383 381
384 ash::ime::InputMethodMenuManager::Get()->SetCurrentInputMethodMenuItemList( 382 input_method::InputMethodManager* manager =
385 menu_item_list); 383 input_method::InputMethodManager::Get();
384 if (manager)
385 manager->SetCurrentInputMethodProperties(property_list);
386
386 return true; 387 return true;
387 } 388 }
388 389
389 bool InputMethodEngine::IsActive() const { 390 bool InputMethodEngine::IsActive() const {
390 return active_; 391 return active_;
391 } 392 }
392 393
393 void InputMethodEngine::KeyEventDone(input_method::KeyEventHandle* key_data, 394 void InputMethodEngine::KeyEventDone(input_method::KeyEventHandle* key_data,
394 bool handled) { 395 bool handled) {
395 KeyEventDoneCallback* callback = 396 KeyEventDoneCallback* callback =
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 576
576 void InputMethodEngine::SetSurroundingText(const std::string& text, 577 void InputMethodEngine::SetSurroundingText(const std::string& text,
577 uint32 cursor_pos, 578 uint32 cursor_pos,
578 uint32 anchor_pos) { 579 uint32 anchor_pos) {
579 observer_->OnSurroundingTextChanged(engine_id_, 580 observer_->OnSurroundingTextChanged(engine_id_,
580 text, 581 text,
581 static_cast<int>(cursor_pos), 582 static_cast<int>(cursor_pos),
582 static_cast<int>(anchor_pos)); 583 static_cast<int>(anchor_pos));
583 } 584 }
584 585
585 // TODO(uekawa): rename this method to a more reasonable name.
586 void InputMethodEngine::MenuItemToProperty( 586 void InputMethodEngine::MenuItemToProperty(
587 const MenuItem& item, 587 const MenuItem& item,
588 ash::ime::InputMethodMenuItem* property) { 588 input_method::InputMethodProperty* property) {
589 property->key = item.id; 589 property->key = item.id;
590 590
591 if (item.modified & MENU_ITEM_MODIFIED_LABEL) { 591 if (item.modified & MENU_ITEM_MODIFIED_LABEL) {
592 property->label = item.label; 592 property->label = item.label;
593 } 593 }
594 if (item.modified & MENU_ITEM_MODIFIED_VISIBLE) { 594 if (item.modified & MENU_ITEM_MODIFIED_VISIBLE) {
595 // TODO(nona): Implement it. 595 // TODO(nona): Implement it.
596 } 596 }
597 if (item.modified & MENU_ITEM_MODIFIED_CHECKED) { 597 if (item.modified & MENU_ITEM_MODIFIED_CHECKED) {
598 property->is_selection_item_checked = item.checked; 598 property->is_selection_item_checked = item.checked;
(...skipping 19 matching lines...) Expand all
618 // TODO(nona): Implement it. 618 // TODO(nona): Implement it.
619 break; 619 break;
620 } 620 }
621 } 621 }
622 } 622 }
623 623
624 // TODO(nona): Support item.children. 624 // TODO(nona): Support item.children.
625 } 625 }
626 626
627 } // namespace chromeos 627 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698