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

Issue 9999018: chrome/browser/chromeos/input_method/ refactoring [part 6 of 6] (Closed)

Created:
8 years, 8 months ago by Yusuke Sato
Modified:
8 years, 8 months ago
CC:
chromium-reviews, sadrul, nkostylev+watch_chromium.org, derat+watch_chromium.org, mihaip+watch_chromium.org, Aaron Boodman, stevenjb+watch_chromium.org, davemoore+watch_chromium.org, yusukes+watch_chromium.org, Zachary Kuznia
Visibility:
Public.

Description

chrome/browser/chromeos/input_method/ refactoring [part 6 of 6]. * Overview of the change The main purpose of this CL is to make InputMethodManager fully unit-testable. To accomplish that, InputMethodManager is modified as follows: - Add setters to set mock versions of IBusController, CandidateWindowController, and XKeyboard. - Move ibus-daemon startup and shutdown code from the manager to IBusControllerImpl. They lived in the manager only for historical reasons. - Remove code for monitoring the status of the connection between Chrome and ibus-daemon (InputMethodManager::OnConnectionChange(bool)). This kind of thing should also be done in IBusControllerImpl. * Details ash/shell.cc: ash/system/ime/tray_ime.cc: ash/system/tray/system_tray*.*: chrome/browser/chromeos/system/ash_system_tray_delegate.cc: Remove unused parameter |is_selection| from the SystemTrayDelegate interface following sadrul's suggestion in http://codereview.chromium.org/10008043/. chrome/browser/chromeos/chrome_browser_main_chromeos.cc: Initialize() and Shutdown() InputMethodManager. chrome/browser/chromeos/extensions/input_method_event_router.h: chrome/browser/chromeos/extensions/input_method_event_router.cc: Follow the interface change of InputMethodManager::Observer. Implementation is not changed at all. chrome/browser/chromeos/input_method/browser_state_monitor.h: chrome/browser/chromeos/input_method/browser_state_monitor.cc: Follow the interface change of InputMethodManager::Observer. Make the class testable by adding some setters and getters. Remove STATE_LOGGING_IN. Since preferences.cc is fixed in #5 of the series of patches, the intermediate state is no longer needed. chrome/browser/chromeos/input_method/browser_state_monitor_unittest.cc: Verify if the implementation updates the correct pref file (i.e. Local\ State or Preferences depending on the browser state). chrome/browser/chromeos/input_method/ibus_controller.h: Simplify the IBusController::Observer interface. Add Start() which is called when a non-XKB input method is enabled. Rename SetImePropertyActivated() to ActivateInputMethodProperty() and remove the second parameter |is_selection| which is no longer needed. Remove CreateInputMethodDescriptor() as we can simply use a constructor in InputMethodDescriptor. chrome/browser/chromeos/input_method/ibus_controller.cc: Move HAVE_IBUS part to chrome/browser/chromeos/input_method/ibus_controller_impl.cc. Move !HAVE_IBUS part to chrome/browser/chromeos/input_method/mock_ibus_controller.cc. Move some functions which do not depend on libibus to chrome/browser/chromeos/input_method/ibus_controller_base.cc. chrome/browser/chromeos/input_method/ibus_controller_base.h: chrome/browser/chromeos/input_method/ibus_controller_base.cc: chrome/browser/chromeos/input_method/ibus_controller_base_unittest.cc: Implement some part of the IBusController interface. Since the files do not depend on libibus, they are unit-testable. chrome/browser/chromeos/input_method/ibus_controller_impl.h: chrome/browser/chromeos/input_method/ibus_controller_impl.cc: Implement libibus dependent part of the IBusController interface. Moved ibus-daemon startup and shutdown code from input_method_manager.cc. Most of other part are unchanged. chrome/browser/chromeos/input_method/ibus_controller_impl_unittest.cc: Tests FindAndUpdateProperty() function in ibus_controller_impl.cc since the function does not use libibus structues/functions. Other functions in ibus_controller_impl.cc will become unit testable soon once crosbug.com/26334 is fixed (by nona@c). chrome/browser/chromeos/input_method/input_method_engine.cc: Follow InputMethodManager interface changes. chrome/browser/chromeos/input_method/input_method_manager.h: Simplify InputMethodManager::Observer interface. Add EnableInputMethods(). We used to set an ibus-daemon config called "preload_engines" to enable input methods, but it is difficult to understand. In addition to the readability problem, the "preload_engines" config has been removed from ibus-1.5. On the daemon side, what we have to do to switch the current input method is just to call ibus_bus_set_global_engine("engine-name") without calling ibus_config_set_value("preload_engiens", ...). So enabling engines by calling SetInputMethodConfig() does not make sense at all now. Rename AddActiveIme() to AddInputMethodExtension(). Do the same for RemoveActiveIme(). Move StartInputMethodDaemon() and StopInputMethodDaemon() to IBusControllerImpl. This should be done automatically in the libibus layer. Add Initialize() and Shutdown() to stop initializing the instance as a singleton. chrome/browser/chromeos/input_method/input_method_manager.cc: Move to input_method_manager_impl.cc. chrome/browser/chromeos/input_method/input_method_manager_impl.h: chrome/browser/chromeos/input_method/input_method_manager_impl.cc: The manager implementation. Fully tested. chrome/browser/chromeos/input_method/input_method_manager_browsertest.cc: chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc: Rename input_method_manager_browsertest.cc to input_method_manager_impl_unittest.cc. Added bunch of unit tests that tests all methods in the manager implementation. chrome/browser/chromeos/login/login_utils_browsertest.cc: chrome/browser/ui/webui/options2/language_options_handler2_unittest.cc: Initialize() and Shutdown() the input method manager instance. chrome/browser/chromeos/login/screen_locker.cc: Move code for changing the set of enabled input methods on lock/unlock to input_method_manager_impl.cc. chrome/browser/chromeos/preferences_unittest.cc: Add a unit test which checks if the correct input method is set as a default one on signing in. Note that the CL compiles and works correctly only with app-i18n/ibus >= 1.4.99. BUG=chromium-os:19655 TEST=try Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=132751

Patch Set 1 : all-in-one-change only for git try #

Patch Set 2 : rebase, add a test to util_unittest.cc #

Patch Set 3 : review #

Patch Set 4 : rebase #

Total comments: 43

Patch Set 5 : rebase, remove preferences.h and language_preference.* from this CL #

Total comments: 10

Patch Set 6 : review fix #

Patch Set 7 : review fix #

Total comments: 5

Patch Set 8 : rebase, remove |should_hide_properties_| #

Total comments: 22

Patch Set 9 : review fix #

Total comments: 2

Patch Set 10 : review fix #

Total comments: 9

Patch Set 11 : review fix #

Patch Set 12 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+4366 lines, -3038 lines) Patch
M ash/shell.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -2 lines 0 comments Download
M ash/system/ime/tray_ime.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +5 lines, -6 lines 0 comments Download
M ash/system/tray/system_tray.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -2 lines 0 comments Download
M ash/system/tray/system_tray_delegate.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/chromeos/chrome_browser_main_chromeos.cc View 1 2 3 3 chunks +6 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/extensions/input_method_event_router.h View 1 chunk +3 lines, -10 lines 0 comments Download
M chrome/browser/chromeos/extensions/input_method_event_router.cc View 3 chunks +3 lines, -16 lines 0 comments Download
M chrome/browser/chromeos/input_method/browser_state_monitor.h View 1 2 3 2 chunks +13 lines, -16 lines 0 comments Download
M chrome/browser/chromeos/input_method/browser_state_monitor.cc View 8 chunks +39 lines, -35 lines 0 comments Download
A chrome/browser/chromeos/input_method/browser_state_monitor_unittest.cc View 1 chunk +392 lines, -0 lines 0 comments Download
chrome/browser/chromeos/input_method/ibus_controller.h View 1 2 3 4 5 6 7 1 chunk +40 lines, -105 lines 0 comments Download
M chrome/browser/chromeos/input_method/ibus_controller.cc View 1 chunk +6 lines, -1157 lines 0 comments Download
A chrome/browser/chromeos/input_method/ibus_controller_base.h View 1 2 3 4 5 6 7 8 9 1 chunk +74 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/ibus_controller_base.cc View 1 2 3 4 5 6 7 8 9 1 chunk +67 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/ibus_controller_base_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +200 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/ibus_controller_impl.h View 1 2 3 4 5 6 7 1 chunk +165 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/ibus_controller_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +977 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/ibus_controller_impl_unittest.cc View 1 chunk +53 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/ibus_controller_unittest.cc View 1 chunk +19 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/input_method/input_method_engine.cc View 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/input_method/input_method_manager.h View 1 2 3 4 5 5 chunks +74 lines, -161 lines 0 comments Download
M chrome/browser/chromeos/input_method/input_method_manager.cc View 1 2 3 4 5 6 7 8 9 1 chunk +27 lines, -1261 lines 0 comments Download
D chrome/browser/chromeos/input_method/input_method_manager_browsertest.cc View 1 chunk +0 lines, -141 lines 0 comments Download
A chrome/browser/chromeos/input_method/input_method_manager_impl.h View 1 2 3 4 5 6 7 8 9 1 chunk +185 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/input_method_manager_impl.cc View 1 2 3 4 5 6 7 8 9 1 chunk +602 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/input_method_manager_impl_unittest.cc View 1 2 3 1 chunk +894 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/input_method_manager_unittest.cc View 1 2 3 4 5 6 1 chunk +27 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/input_method/input_method_util.h View 1 2 3 1 chunk +0 lines, -2 lines 0 comments Download
A chrome/browser/chromeos/input_method/mock_ibus_controller.h View 1 2 3 4 5 6 7 8 1 chunk +63 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/mock_ibus_controller.cc View 1 2 3 4 5 6 7 1 chunk +68 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/mock_input_method_manager.h View 1 2 3 4 5 6 7 8 9 1 chunk +86 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/input_method/mock_input_method_manager.cc View 1 2 3 4 5 1 chunk +143 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/login_utils_browsertest.cc View 1 2 3 4 5 6 7 3 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/screen_locker.cc View 1 2 3 4 5 6 7 8 9 4 chunks +0 lines, -86 lines 0 comments Download
chrome/browser/chromeos/preferences.cc View 1 2 3 4 5 6 3 chunks +9 lines, -12 lines 0 comments Download
A chrome/browser/chromeos/preferences_unittest.cc View 1 chunk +77 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/system/ash_system_tray_delegate.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +6 lines, -18 lines 0 comments Download
M chrome/browser/ui/webui/options2/language_options_handler2_unittest.cc View 1 chunk +11 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +9 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +10 lines, -1 line 0 comments Download

Messages

Total messages: 29 (0 generated)
Yusuke Sato
kinaba, nona, sorry for sending such a huge change... but please help me review it. ...
8 years, 8 months ago (2012-04-12 07:47:32 UTC) #1
Yusuke Sato
http://codereview.chromium.org/9999018/diff/10009/chrome/browser/chromeos/input_method/ibus_controller_impl.cc File chrome/browser/chromeos/input_method/ibus_controller_impl.cc (right): http://codereview.chromium.org/9999018/diff/10009/chrome/browser/chromeos/input_method/ibus_controller_impl.cc#newcode59 chrome/browser/chromeos/input_method/ibus_controller_impl.cc:59: const char* Or(const char* str1, const char* str2) { ...
8 years, 8 months ago (2012-04-12 08:56:50 UTC) #2
Yusuke Sato
kinaba, nona, to be exact, please review only the following files: chrome/browser/chromeos/* chrome/browser/chromeos/input_method/* chrome/browser/chromeos/login/screen_locker.cc Other ...
8 years, 8 months ago (2012-04-12 09:01:16 UTC) #3
Seigo Nonaka
http://codereview.chromium.org/9999018/diff/10009/chrome/browser/chromeos/input_method/input_method_manager.h File chrome/browser/chromeos/input_method/input_method_manager.h (right): http://codereview.chromium.org/9999018/diff/10009/chrome/browser/chromeos/input_method/input_method_manager.h#newcode79 chrome/browser/chromeos/input_method/input_method_manager.h:79: virtual InputMethodDescriptors* GetSupportedInputMethods() = 0; I think this function ...
8 years, 8 months ago (2012-04-13 04:03:14 UTC) #4
Yusuke Sato
http://codereview.chromium.org/9999018/diff/10009/chrome/browser/chromeos/input_method/input_method_manager.h File chrome/browser/chromeos/input_method/input_method_manager.h (right): http://codereview.chromium.org/9999018/diff/10009/chrome/browser/chromeos/input_method/input_method_manager.h#newcode79 chrome/browser/chromeos/input_method/input_method_manager.h:79: virtual InputMethodDescriptors* GetSupportedInputMethods() = 0; On 2012/04/13 04:03:14, nona1 ...
8 years, 8 months ago (2012-04-13 08:00:45 UTC) #5
kinaba
Reviewed the codes _except_ unittest parts (review for the tests will come later). Only a ...
8 years, 8 months ago (2012-04-13 08:08:52 UTC) #6
Yusuke Sato
http://codereview.chromium.org/9999018/diff/13002/chrome/browser/chromeos/input_method/ibus_controller_impl.h File chrome/browser/chromeos/input_method/ibus_controller_impl.h (right): http://codereview.chromium.org/9999018/diff/13002/chrome/browser/chromeos/input_method/ibus_controller_impl.h#newcode156 chrome/browser/chromeos/input_method/ibus_controller_impl.h:156: // An object which knows all valid input method ...
8 years, 8 months ago (2012-04-13 08:59:28 UTC) #7
Seigo Nonaka
Sorry for hashed reply. I reviewed input_method_manager_impl.* I will review the rest files as soon ...
8 years, 8 months ago (2012-04-13 09:44:22 UTC) #8
Yusuke Sato
http://codereview.chromium.org/9999018/diff/8092/chrome/browser/chromeos/input_method/input_method_manager_impl.cc File chrome/browser/chromeos/input_method/input_method_manager_impl.cc (right): http://codereview.chromium.org/9999018/diff/8092/chrome/browser/chromeos/input_method/input_method_manager_impl.cc#newcode257 chrome/browser/chromeos/input_method/input_method_manager_impl.cc:257: } else { On 2012/04/13 09:44:22, nona1 wrote: > ...
8 years, 8 months ago (2012-04-16 02:11:25 UTC) #9
Yusuke Sato
Please take another look. In addition to addressing nona's comments, I've removed the parameter of ...
8 years, 8 months ago (2012-04-16 05:54:30 UTC) #10
Yusuke Sato
+zork Zach, please review the following files (and overall structure of the change, of course): ...
8 years, 8 months ago (2012-04-16 05:55:40 UTC) #11
kinaba
LGTM with very few nits (but I'd like to wait for Zach's comment, too :)). ...
8 years, 8 months ago (2012-04-16 10:22:53 UTC) #12
Yusuke Sato
http://codereview.chromium.org/9999018/diff/15002/chrome/browser/chromeos/input_method/ibus_controller_base.cc File chrome/browser/chromeos/input_method/ibus_controller_base.cc (right): http://codereview.chromium.org/9999018/diff/15002/chrome/browser/chromeos/input_method/ibus_controller_base.cc#newcode33 chrome/browser/chromeos/input_method/ibus_controller_base.cc:33: return SetInputMethodConfigInternal(key, value); On 2012/04/16 10:22:53, kinaba wrote: > ...
8 years, 8 months ago (2012-04-16 11:25:43 UTC) #13
Seigo Nonaka
lgtm lgtm http://codereview.chromium.org/9999018/diff/16008/chrome/browser/chromeos/input_method/ibus_controller_base.h File chrome/browser/chromeos/input_method/ibus_controller_base.h (right): http://codereview.chromium.org/9999018/diff/16008/chrome/browser/chromeos/input_method/ibus_controller_base.h#newcode15 chrome/browser/chromeos/input_method/ibus_controller_base.h:15: #include "chrome/browser/chromeos/input_method/ibus_controller.h" nit: alphabetic order if possible.
8 years, 8 months ago (2012-04-16 16:17:16 UTC) #14
Zachary Kuznia
http://codereview.chromium.org/9999018/diff/15002/chrome/browser/chromeos/input_method/ibus_controller_base.cc File chrome/browser/chromeos/input_method/ibus_controller_base.cc (right): http://codereview.chromium.org/9999018/diff/15002/chrome/browser/chromeos/input_method/ibus_controller_base.cc#newcode48 chrome/browser/chromeos/input_method/ibus_controller_base.cc:48: = current_config_values_.find(key); Nit: I think the = should be ...
8 years, 8 months ago (2012-04-17 01:26:35 UTC) #15
Yusuke Sato
http://codereview.chromium.org/9999018/diff/15002/chrome/browser/chromeos/input_method/ibus_controller_base.cc File chrome/browser/chromeos/input_method/ibus_controller_base.cc (right): http://codereview.chromium.org/9999018/diff/15002/chrome/browser/chromeos/input_method/ibus_controller_base.cc#newcode48 chrome/browser/chromeos/input_method/ibus_controller_base.cc:48: = current_config_values_.find(key); On 2012/04/17 01:26:36, Zachary Kuznia wrote: > ...
8 years, 8 months ago (2012-04-17 02:23:32 UTC) #16
Zachary Kuznia
lgtm
8 years, 8 months ago (2012-04-17 02:26:49 UTC) #17
Yusuke Sato
mukai, Could you briefly check ash/ and chrome/browser/chromeos/system/ash_system_tray_delegate.cc changes? I've slightly modified your IME property ...
8 years, 8 months ago (2012-04-17 03:42:28 UTC) #18
Jun Mukai
lgtm It looks good. Put a few nitpicks. You may want to take a look ...
8 years, 8 months ago (2012-04-17 03:55:05 UTC) #19
Yusuke Sato
+csilv Chris, could you do owners review for chrome/browser/ui/webui/options2/language_options_handler2_unittest.cc? The change is simple: Since InputMethodManager ...
8 years, 8 months ago (2012-04-17 03:56:46 UTC) #20
Yusuke Sato
+nkostylev Nikita, could you do owners review for chrome/browser/chromeos/login/? IME setup code in login/screen_locker.cc is ...
8 years, 8 months ago (2012-04-17 04:01:12 UTC) #21
Yusuke Sato
http://codereview.chromium.org/9999018/diff/25001/ash/system/ime/tray_ime.cc File ash/system/ime/tray_ime.cc (right): http://codereview.chromium.org/9999018/diff/25001/ash/system/ime/tray_ime.cc#newcode7 ash/system/ime/tray_ime.cc:7: #include <utility> On 2012/04/17 03:55:05, Jun Mukai wrote: > ...
8 years, 8 months ago (2012-04-17 04:33:32 UTC) #22
Jun Mukai
lgtm http://codereview.chromium.org/9999018/diff/25001/chrome/browser/chromeos/input_method/ibus_controller_impl.cc File chrome/browser/chromeos/input_method/ibus_controller_impl.cc (right): http://codereview.chromium.org/9999018/diff/25001/chrome/browser/chromeos/input_method/ibus_controller_impl.cc#newcode499 chrome/browser/chromeos/input_method/ibus_controller_impl.cc:499: if (current_property_list_[i].key == key) { On 2012/04/17 04:33:32, ...
8 years, 8 months ago (2012-04-17 04:42:52 UTC) #23
Yusuke Sato
+sky, Scott, could you review ash/? This CL reverts mukai's r131583 to follow an interface ...
8 years, 8 months ago (2012-04-17 04:52:15 UTC) #24
Nikita (slow)
On 2012/04/17 04:01:12, Yusuke Sato wrote: > +nkostylev > Nikita, could you do owners review ...
8 years, 8 months ago (2012-04-17 11:49:30 UTC) #25
sky
LGTM
8 years, 8 months ago (2012-04-17 16:12:45 UTC) #26
csilv
language_options_handler2_unittest.cc owner lgtm
8 years, 8 months ago (2012-04-17 17:32:26 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yusukes@chromium.org/9999018/32001
8 years, 8 months ago (2012-04-18 05:47:12 UTC) #28
commit-bot: I haz the power
8 years, 8 months ago (2012-04-18 05:47:17 UTC) #29
Can't process patch for file chrome/browser/chromeos/preferences.cc.
File's status is None, patchset upload is incomplete.

Powered by Google App Engine
This is Rietveld 408576698