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

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

Issue 9852008: Update IME preferences outside the IME status button when Uber Tray is in use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retry Created 8 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_manager.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include <glib.h> 9 #include <glib.h>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/process_util.h" 15 #include "base/process_util.h"
16 #include "base/string_split.h" 16 #include "base/string_split.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/chromeos/input_method/browser_state_monitor.h"
20 #include "chrome/browser/chromeos/input_method/input_method_util.h" 21 #include "chrome/browser/chromeos/input_method/input_method_util.h"
21 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" 22 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
22 #include "chrome/browser/chromeos/input_method/virtual_keyboard_selector.h" 23 #include "chrome/browser/chromeos/input_method/virtual_keyboard_selector.h"
23 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 24 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
24 #include "chrome/browser/chromeos/language_preferences.h" 25 #include "chrome/browser/chromeos/language_preferences.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
28 #include "content/public/browser/notification_service.h" 29 #include "content/public/browser/notification_service.h"
29 #include "content/public/browser/notification_types.h" 30 #include "content/public/browser/notification_types.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 : ibus_controller_(IBusController::Create()), 78 : ibus_controller_(IBusController::Create()),
78 should_hide_properties_(true), 79 should_hide_properties_(true),
79 should_launch_ime_(false), 80 should_launch_ime_(false),
80 ime_connected_(false), 81 ime_connected_(false),
81 enable_auto_ime_shutdown_(false), // workaround for crosbug.com/27051. 82 enable_auto_ime_shutdown_(false), // workaround for crosbug.com/27051.
82 enable_extension_imes_(true), 83 enable_extension_imes_(true),
83 shutting_down_(false), 84 shutting_down_(false),
84 ibus_daemon_process_handle_(base::kNullProcessHandle), 85 ibus_daemon_process_handle_(base::kNullProcessHandle),
85 util_(whitelist_.GetSupportedInputMethods()), 86 util_(whitelist_.GetSupportedInputMethods()),
86 xkeyboard_(XKeyboard::Create(util_)), 87 xkeyboard_(XKeyboard::Create(util_)),
88 ALLOW_THIS_IN_INITIALIZER_LIST(
89 browser_state_monitor_(new BrowserStateMonitor(this))),
87 ignore_hotkeys_(false) { 90 ignore_hotkeys_(false) {
88 // Observe APP_TERMINATING to stop input method daemon gracefully. 91 // Observe APP_TERMINATING to stop input method daemon gracefully.
89 // We should not use APP_EXITING here since logout might be canceled by 92 // We should not use APP_EXITING here since logout might be canceled by
90 // JavaScript after APP_EXITING is sent (crosbug.com/11055). 93 // JavaScript after APP_EXITING is sent (crosbug.com/11055).
91 // Note that even if we fail to stop input method daemon from 94 // Note that even if we fail to stop input method daemon from
92 // Chrome in case of a sudden crash, we have a way to do it from an 95 // Chrome in case of a sudden crash, we have a way to do it from an
93 // upstart script. See crosbug.com/6515 and crosbug.com/6995 for 96 // upstart script. See crosbug.com/6515 and crosbug.com/6995 for
94 // details. 97 // details.
95 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, 98 notification_registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING,
96 content::NotificationService::AllSources()); 99 content::NotificationService::AllSources());
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 // Stop the input method daemon on browser shutdown. 1207 // Stop the input method daemon on browser shutdown.
1205 if (type == content::NOTIFICATION_APP_TERMINATING) { 1208 if (type == content::NOTIFICATION_APP_TERMINATING) {
1206 shutting_down_ = true; 1209 shutting_down_ = true;
1207 notification_registrar_.RemoveAll(); 1210 notification_registrar_.RemoveAll();
1208 StopInputMethodDaemon(); 1211 StopInputMethodDaemon();
1209 #if !defined(USE_VIRTUAL_KEYBOARD) 1212 #if !defined(USE_VIRTUAL_KEYBOARD)
1210 if (candidate_window_controller_.get()) 1213 if (candidate_window_controller_.get())
1211 candidate_window_controller_->RemoveObserver(this); 1214 candidate_window_controller_->RemoveObserver(this);
1212 candidate_window_controller_.reset(NULL); 1215 candidate_window_controller_.reset(NULL);
1213 #endif 1216 #endif
1217 // |browser_state_monitor_| has to be destructed while the PrefService
1218 // object associated with the monitor is alive. (crbug.com/120183)
1219 browser_state_monitor_.reset();
1214 } 1220 }
1215 } 1221 }
1216 1222
1217 // The IBus controller is used to control the input method status and 1223 // The IBus controller is used to control the input method status and
1218 // allow allow callbacks when the input method status changes. 1224 // allow allow callbacks when the input method status changes.
1219 scoped_ptr<IBusController> ibus_controller_; 1225 scoped_ptr<IBusController> ibus_controller_;
1220 ObserverList<InputMethodManager::Observer> observers_; 1226 ObserverList<InputMethodManager::Observer> observers_;
1221 ObserverList<InputMethodManager::CandidateWindowObserver> 1227 ObserverList<InputMethodManager::CandidateWindowObserver>
1222 candidate_window_observers_; 1228 candidate_window_observers_;
1223 ObserverList<PreferenceObserver> pre_login_preference_observers_; 1229 ObserverList<PreferenceObserver> pre_login_preference_observers_;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 InputMethodWhitelist whitelist_; 1297 InputMethodWhitelist whitelist_;
1292 1298
1293 // An object which provides miscellaneous input method utility functions. Note 1299 // An object which provides miscellaneous input method utility functions. Note
1294 // that |util_| is required to initialize |xkeyboard_|. 1300 // that |util_| is required to initialize |xkeyboard_|.
1295 InputMethodUtil util_; 1301 InputMethodUtil util_;
1296 1302
1297 // An object for switching XKB layouts and keyboard status like caps lock and 1303 // An object for switching XKB layouts and keyboard status like caps lock and
1298 // auto-repeat interval. 1304 // auto-repeat interval.
1299 scoped_ptr<XKeyboard> xkeyboard_; 1305 scoped_ptr<XKeyboard> xkeyboard_;
1300 1306
1307 // An object which monitors a notification from the browser to keep track of
1308 // the browser state (not logged in, logged in, etc.).
1309 scoped_ptr<BrowserStateMonitor> browser_state_monitor_;
1310
1301 // true when DisableHotkeys() is called to temporarily disable IME hotkeys. 1311 // true when DisableHotkeys() is called to temporarily disable IME hotkeys.
1302 // EnableHotkeys() resets the flag to the default value, false. 1312 // EnableHotkeys() resets the flag to the default value, false.
1303 bool ignore_hotkeys_; 1313 bool ignore_hotkeys_;
1304 1314
1305 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); 1315 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl);
1306 }; 1316 };
1307 1317
1308 // static 1318 // static
1309 InputMethodManager* InputMethodManager::GetInstance() { 1319 InputMethodManager* InputMethodManager::GetInstance() {
1310 return InputMethodManagerImpl::GetInstance(); 1320 return InputMethodManagerImpl::GetInstance();
1311 } 1321 }
1312 1322
1313 } // namespace input_method 1323 } // namespace input_method
1314 } // namespace chromeos 1324 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_manager.h ('k') | chrome/browser/chromeos/preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698